From 685f2fa9a8637c1f14601b5ba679b981577ad568 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 24 Jul 2023 09:03:25 +0200 Subject: [PATCH] test: fix running test_build_package.py standalone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the "args" fixture to test_skip_already_built, so it correctly initializes logging (and indirectly pmb.helpers.other.cache). With this it becomes possible to run the test file on its own. See "def args" on top of the file for implementation of the "args" fixture. Fix for: $ pytest -xvv test/test_build_package.py … > assert pmb.helpers.other.cache["built"] == {} E TypeError: 'NoneType' object is not subscriptable Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230724070509.1885-2-ollieparanoid@postmarketos.org%3E --- test/test_build_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_build_package.py b/test/test_build_package.py index db75c804..6138a572 100644 --- a/test/test_build_package.py +++ b/test/test_build_package.py @@ -57,7 +57,7 @@ def args_patched(monkeypatch, argv): return pmb.parse.arguments() -def test_skip_already_built(): +def test_skip_already_built(args): func = pmb.build._package.skip_already_built assert pmb.helpers.other.cache["built"] == {} assert func("test-package", "armhf") is False