diff mbox series

[3/3] tests: Make sure test_lfs_enabled is ran with git lfs available

Message ID 20230210133921.1268885-3-paulo@myneves.com
State New
Headers show
Series [1/3] tests: Remove redundant lfs=1 URI paramter | expand

Commit Message

Paulo Neves Feb. 10, 2023, 1:39 p.m. UTC
If git lfs does not exist in the host the test does not run all
the code paths possible, thus is not reproducile

Signed-off-by: Paulo Neves <paulo@myneves.com>
---
 lib/bb/tests/fetch.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--
2.34.1
diff mbox series

Patch

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index a9ad247d9..9b18f159d 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -2243,13 +2243,12 @@  class GitLfsTest(FetcherTest):
         # we know whether git-lfs is installed.
         fetcher, ud = self.fetch(uri=None, download=False)
         self.assertIsNotNone(ud.method._find_git_lfs)
+        self.assertTrue(ud.method._find_git_lfs(self.d),
+                msg="git-lfs not found. Cannot test git-lfs without git-lfs in the PATH")

-        # If git-lfs can be found, the unpack should be successful. Only
-        # attempt this with the real live copy of git-lfs installed.
-        if ud.method._find_git_lfs(self.d):
-            fetcher.download()
-            shutil.rmtree(self.gitdir, ignore_errors=True)
-            fetcher.unpack(self.d.getVar('WORKDIR'))
+        fetcher.download()
+        shutil.rmtree(self.gitdir, ignore_errors=True)
+        fetcher.unpack(self.d.getVar('WORKDIR'))

         # If git-lfs cannot be found, the unpack should throw an error
         with self.assertRaises(bb.fetch2.FetchError):