summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaulo Neves <paulo@myneves.com>2024-02-27 07:18:06 +0100
committerSteve Sakoman <steve@sakoman.com>2024-03-01 08:00:58 -1000
commitb67823515e8258bf28f2b2618e17ac9b8b0ea7be (patch)
treed2c7c83d4e5e3fef01f2e880a16b55847b297090 /bitbake
parentd1299791a5f6609199a8da0d758d423602d40f2a (diff)
downloadpoky-b67823515e8258bf28f2b2618e17ac9b8b0ea7be.tar.gz
bitbake: tests/fetch: git-lfs restore _find_git_lfs
Not restoring the mocked _find_git_lfs leads to other tests failing. (cherry picked from commit 70f848631450bd723c223227c21c60e815ee033d) (Bitbake rev: 1d5d4a46c772f44ab652f95b37f508b890828e67) Signed-off-by: Paulo Neves <paulo@myneves.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de> Signed-off-by: Steve Sakoman <steve@sakoman.com>
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 7bace415d0..743d3e3ff5 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -2210,12 +2210,16 @@ class GitLfsTest(FetcherTest):
2210 shutil.rmtree(self.gitdir, ignore_errors=True) 2210 shutil.rmtree(self.gitdir, ignore_errors=True)
2211 fetcher.unpack(self.d.getVar('WORKDIR')) 2211 fetcher.unpack(self.d.getVar('WORKDIR'))
2212 2212
2213 # If git-lfs cannot be found, the unpack should throw an error 2213 old_find_git_lfs = ud.method._find_git_lfs
2214 with self.assertRaises(bb.fetch2.FetchError): 2214 try:
2215 fetcher.download() 2215 # If git-lfs cannot be found, the unpack should throw an error
2216 ud.method._find_git_lfs = lambda d: False 2216 with self.assertRaises(bb.fetch2.FetchError):
2217 shutil.rmtree(self.gitdir, ignore_errors=True) 2217 fetcher.download()
2218 fetcher.unpack(self.d.getVar('WORKDIR')) 2218 ud.method._find_git_lfs = lambda d: False
2219 shutil.rmtree(self.gitdir, ignore_errors=True)
2220 fetcher.unpack(self.d.getVar('WORKDIR'))
2221 finally:
2222 ud.method._find_git_lfs = old_find_git_lfs
2219 2223
2220 def test_lfs_disabled(self): 2224 def test_lfs_disabled(self):
2221 import shutil 2225 import shutil
@@ -2230,17 +2234,21 @@ class GitLfsTest(FetcherTest):
2230 fetcher, ud = self.fetch() 2234 fetcher, ud = self.fetch()
2231 self.assertIsNotNone(ud.method._find_git_lfs) 2235 self.assertIsNotNone(ud.method._find_git_lfs)
2232 2236
2233 # If git-lfs can be found, the unpack should be successful. A 2237 old_find_git_lfs = ud.method._find_git_lfs
2234 # live copy of git-lfs is not required for this case, so 2238 try:
2235 # unconditionally forge its presence. 2239 # If git-lfs can be found, the unpack should be successful. A
2236 ud.method._find_git_lfs = lambda d: True 2240 # live copy of git-lfs is not required for this case, so
2237 shutil.rmtree(self.gitdir, ignore_errors=True) 2241 # unconditionally forge its presence.
2238 fetcher.unpack(self.d.getVar('WORKDIR')) 2242 ud.method._find_git_lfs = lambda d: True
2243 shutil.rmtree(self.gitdir, ignore_errors=True)
2244 fetcher.unpack(self.d.getVar('WORKDIR'))
2245 # If git-lfs cannot be found, the unpack should be successful
2239 2246
2240 # If git-lfs cannot be found, the unpack should be successful 2247 ud.method._find_git_lfs = lambda d: False
2241 ud.method._find_git_lfs = lambda d: False 2248 shutil.rmtree(self.gitdir, ignore_errors=True)
2242 shutil.rmtree(self.gitdir, ignore_errors=True) 2249 fetcher.unpack(self.d.getVar('WORKDIR'))
2243 fetcher.unpack(self.d.getVar('WORKDIR')) 2250 finally:
2251 ud.method._find_git_lfs = old_find_git_lfs
2244 2252
2245class GitURLWithSpacesTest(FetcherTest): 2253class GitURLWithSpacesTest(FetcherTest):
2246 test_git_urls = { 2254 test_git_urls = {