make test work with pmbootstrap 3.0.0
The current tests are written against pmbootstrap 2.3.x. Test infrastructure works quite differently with 3.0.0. I've tried to port it for some time now, but it is not trivial. I'll focus on making monitoring work at all again with 2.3.x (and fixing badges), we can later port the tests to 3.0.0.
diff --git a/test_upstream_compat.py b/test_upstream_compat.py
index cbdb63d..e8a38be 100644
--- a/test_upstream_compat.py
+++ b/test_upstream_compat.py
@@ -11,29 +11,19 @@ import pmb.helpers.logging
import pmb.parse.apkindex
import pmb.parse
+from pmb.conftest import logfile, mock_context, config_file, pmb_args, pmaports
-@pytest.fixture
-def args(request):
- # Initialize args
- sys.argv = ["pmbootstrap",
- "--aports", os.environ["PMAPORTS"],
- "chroot"]
- args = pmb.parse.arguments()
- # Initialize logging
- pmb.helpers.logging.init(args)
- request.addfinalizer(pmb.helpers.logging.logfd.close)
- return args
-
-
-def test_aportgen_versions(args):
+def test_aportgen_versions(pmb_args, pmaports):
"""
Verify that the packages generated by 'pmbootstrap aportgen' have
the same version (pkgver *and* pkgrel!) as the upstream packages
they are based on.
"""
+ pmaports = os.environ["PMAPORTS"]
+
# Get Alpine's "main" repository APKINDEX path
- index = pmb.helpers.repo.alpine_apkindex_path(args, "main", "x86_64")
+ index = pmb.helpers.repo.alpine_apkindex_path("main", "x86_64")
# Alpine packages and patterns for our derivatives
map = {"binutils": "binutils-*",
@@ -47,12 +37,11 @@ def test_aportgen_versions(args):
generated = "# Automatically generated aport, do not edit!"
for pkgname, pattern in map.items():
# Upstream version
- index_data = pmb.parse.apkindex.package(args, pkgname,
- indexes=[index])
+ index_data = pmb.parse.apkindex.package(pkgname, indexes=[index])
version_upstream = index_data["version"]
# Iterate over our packages
- for path in glob.glob(args.aports + "/*/" + pattern + "/APKBUILD"):
+ for path in glob.glob(os.path.join(pmaports, "*", pattern, "APKBUILD")):
# Skip non-aportgen APKBUILDs
with open(path) as handle:
if generated not in handle.read():
@@ -71,12 +60,12 @@ def test_aportgen_versions(args):
assert [] == failed
-def test_soname_bump(args):
+def test_soname_bump():
""" Use pmb.helpers.pkgrel_bump to check if the pmaports need a pkgrel bump
caused by a soname bump in Alpine. Example: a new openssl version was
released, which increased the soname version, and now all packages that
link against it, need to be rebuilt. """
- if pmb.helpers.pkgrel_bump.auto(args, True):
+ if pmb.helpers.pkgrel_bump.auto(True):
raise RuntimeError("One or more packages need to be rebuilt, because"
" a library they link against had an incompatible"
" upgrade (soname bump). Run 'pmbootstrap"