test: fix test_build_depends_binary_outdated
After we have removed binutils-aarch64 etc. from pmaports, this test started to fail with the following: Failed: DID NOT RAISE <class 'RuntimeError'> Rewrite it to try to build "hello-world-wrapper" instead, and mark its dependency "hello-world" as outdated. While it's not great to depend on packages in pmaports for testing, at least these two are explicitly made for the testsuite and are less likely to change. Related: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/3275 Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230724070509.1885-3-ollieparanoid@postmarketos.org%3E
This commit is contained in:
parent
685f2fa9a8
commit
93bf267481
|
@ -178,16 +178,16 @@ def test_build_depends_no_binary_error(args, monkeypatch):
|
|||
def test_build_depends_binary_outdated(args, monkeypatch):
|
||||
""" pmbootstrap runs with --no-depends and dependency binary package is
|
||||
outdated (#1895) """
|
||||
# Override pmb.parse.apkindex.package(): pretend hello-world is missing
|
||||
# and binutils-aarch64 is outdated
|
||||
# Override pmb.parse.apkindex.package(): pretend hello-world-wrapper is
|
||||
# missing and hello-world is outdated
|
||||
func_orig = pmb.parse.apkindex.package
|
||||
|
||||
def func_patch(args, package, *args2, **kwargs):
|
||||
print(f"func_patch: called for package: {package}")
|
||||
if package == "hello-world":
|
||||
if package == "hello-world-wrapper":
|
||||
print("pretending that it does not exist")
|
||||
return None
|
||||
if package == "binutils-aarch64":
|
||||
if package == "hello-world":
|
||||
print("pretending that it is outdated")
|
||||
ret = func_orig(args, package, *args2, **kwargs)
|
||||
ret["version"] = "0-r0"
|
||||
|
@ -195,15 +195,15 @@ def test_build_depends_binary_outdated(args, monkeypatch):
|
|||
return func_orig(args, package, *args2, **kwargs)
|
||||
monkeypatch.setattr(pmb.parse.apkindex, "package", func_patch)
|
||||
|
||||
# Build hello-world with --no-depends and expect failure
|
||||
# Build hello-world-wrapper with --no-depends and expect failure
|
||||
args.no_depends = True
|
||||
pkgname = "hello-world"
|
||||
arch = "aarch64"
|
||||
pkgname = "hello-world-wrapper"
|
||||
arch = "x86_64"
|
||||
force = False
|
||||
strict = True
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
pmb.build.package(args, pkgname, arch, force, strict)
|
||||
assert "'binutils-aarch64' of 'gcc-aarch64' is outdated" in str(e.value)
|
||||
assert "'hello-world' of 'hello-world-wrapper' is outdated" in str(e.value)
|
||||
|
||||
|
||||
def test_is_necessary_warn_depends(args, monkeypatch):
|
||||
|
|
Loading…
Reference in New Issue