summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaulo Neves <paulo@myneves.com>2023-02-17 17:00:23 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-22 12:03:39 +0000
commit41c86ad30e2faec6ad286b9131578183b6a17d24 (patch)
tree8619bc5c99bdf4993c9759da8974df131ebf1e1f /bitbake
parent76db0baba26a5da5382f7cc44c64eb705e24e638 (diff)
downloadpoky-41c86ad30e2faec6ad286b9131578183b6a17d24.tar.gz
bitbake: tests/fetch: git-lfs restore _find_git_lfs
Not restoring the mocked _find_git_lfs leads to other tests failing. (Bitbake rev: 70f848631450bd723c223227c21c60e815ee033d) Signed-off-by: Paulo Neves <paulo@myneves.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 = {