args.cache: remove (MR 2136)

Replace "args.cache" with a global variable in order to
avoid passing "args" to all functions. This is a step to get rid of this
args-passed-to-all-functions pattern in pmbootstrap.
This commit is contained in:
BO41 2021-10-30 14:20:57 +02:00 committed by Oliver Smith
parent f30b1cc3f2
commit ce0f1c2d4a
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
23 changed files with 127 additions and 115 deletions

View file

@ -58,9 +58,9 @@ def args_patched(monkeypatch, argv):
def test_skip_already_built(args):
func = pmb.build._package.skip_already_built
assert args.cache["built"] == {}
assert pmb.helpers.other.cache["built"] == {}
assert func(args, "test-package", "armhf") is False
assert args.cache["built"] == {"armhf": ["test-package"]}
assert pmb.helpers.other.cache["built"] == {"armhf": ["test-package"]}
assert func(args, "test-package", "armhf") is True
@ -323,11 +323,11 @@ def test_package(args):
assert pmb.build.package(args, "hello-world", force=True)
# Package exists
args.cache["built"] = {}
pmb.helpers.other.cache["built"] = {}
assert pmb.build.package(args, "hello-world") is None
# Force building again
args.cache["built"] = {}
pmb.helpers.other.cache["built"] = {}
assert pmb.build.package(args, "hello-world", force=True)
# Build for another architecture
@ -363,7 +363,7 @@ def test_build_depends_high_level(args, monkeypatch):
# Remove hello-world
pmb.helpers.run.root(args, ["rm", output_hello_outside])
pmb.build.index_repo(args, pmb.config.arch_native)
args.cache["built"] = {}
pmb.helpers.other.cache["built"] = {}
# Ask to build the wrapper. It should not build the wrapper (it exists, not
# using force), but build/update its missing dependency "hello-world"