summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/fetch.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index f3890321d6..6d16cf59a1 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -2250,12 +2250,16 @@ class GitLfsTest(FetcherTest):
2250 shutil.rmtree(self.gitdir, ignore_errors=True) 2250 shutil.rmtree(self.gitdir, ignore_errors=True)
2251 fetcher.unpack(self.d.getVar('WORKDIR')) 2251 fetcher.unpack(self.d.getVar('WORKDIR'))
2252 2252
2253 # If git-lfs cannot be found, the unpack should throw an error 2253 old_find_git_lfs = ud.method._find_git_lfs
2254 with self.assertRaises(bb.fetch2.FetchError): 2254 try:
2255 fetcher.download() 2255 # If git-lfs cannot be found, the unpack should throw an error
2256 ud.method._find_git_lfs = lambda d: False 2256 with self.assertRaises(bb.fetch2.FetchError):
2257 shutil.rmtree(self.gitdir, ignore_errors=True) 2257 fetcher.download()
2258 fetcher.unpack(self.d.getVar('WORKDIR')) 2258 ud.method._find_git_lfs = lambda d: False
2259 shutil.rmtree(self.gitdir, ignore_errors=True)
2260 fetcher.unpack(self.d.getVar('WORKDIR'))
2261 finally:
2262 ud.method._find_git_lfs = old_find_git_lfs
2259 2263
2260 def test_lfs_disabled(self): 2264 def test_lfs_disabled(self):
2261 import shutil 2265 import shutil
@@ -2270,17 +2274,21 @@ class GitLfsTest(FetcherTest):
2270 fetcher, ud = self.fetch() 2274 fetcher, ud = self.fetch()
2271 self.assertIsNotNone(ud.method._find_git_lfs) 2275 self.assertIsNotNone(ud.method._find_git_lfs)
2272 2276
2273 # If git-lfs can be found, the unpack should be successful. A 2277 old_find_git_lfs = ud.method._find_git_lfs
2274 # live copy of git-lfs is not required for this case, so 2278 try:
2275 # unconditionally forge its presence. 2279 # If git-lfs can be found, the unpack should be successful. A
2276 ud.method._find_git_lfs = lambda d: True 2280 # live copy of git-lfs is not required for this case, so
2277 shutil.rmtree(self.gitdir, ignore_errors=True) 2281 # unconditionally forge its presence.
2278 fetcher.unpack(self.d.getVar('WORKDIR')) 2282 ud.method._find_git_lfs = lambda d: True
2283 shutil.rmtree(self.gitdir, ignore_errors=True)
2284 fetcher.unpack(self.d.getVar('WORKDIR'))
2285 # If git-lfs cannot be found, the unpack should be successful
2279 2286
2280 # If git-lfs cannot be found, the unpack should be successful 2287 ud.method._find_git_lfs = lambda d: False
2281 ud.method._find_git_lfs = lambda d: False 2288 shutil.rmtree(self.gitdir, ignore_errors=True)
2282 shutil.rmtree(self.gitdir, ignore_errors=True) 2289 fetcher.unpack(self.d.getVar('WORKDIR'))
2283 fetcher.unpack(self.d.getVar('WORKDIR')) 2290 finally:
2291 ud.method._find_git_lfs = old_find_git_lfs
2284 2292
2285class GitURLWithSpacesTest(FetcherTest): 2293class GitURLWithSpacesTest(FetcherTest):
2286 test_git_urls = { 2294 test_git_urls = {