]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add support for pytest>=9.0.0
authorNicki Křížek <nicki@isc.org>
Tue, 16 Dec 2025 16:48:04 +0000 (17:48 +0100)
committerNicki Křížek <nicki@isc.org>
Wed, 21 Jan 2026 15:34:03 +0000 (16:34 +0100)
Use collection_path rather than the deprecated path argument for
pytest_ignore_collect() hook.

The collection_path argument was added in pytest 7.0.0, which is the
minimum supported pytest version from now on.

(cherry picked from commit 093bef9211b252653425f4477aa513d85e260cef)

.gitlab-ci.yml
bin/tests/system/conftest.py

index ca8c457ef916189f7283ed2bda2ac66a4c89f367..1144419de478317610331bb43cdac5b4ff9b4285 100644 (file)
@@ -506,10 +506,6 @@ stages:
     - ( if [ "${CI_DISPOSABLE_ENVIRONMENT}" = "true" ]; then sleep 3000; "$PYTHON" "${CI_PROJECT_DIR}/util/get-running-system-tests.py"; fi ) &
     - cd bin/tests/system
     - RET=0
-    # With pytest 9.0, there's the following error in pytest_ignore_collect():
-    #   The (path: py.path.local) argument is deprecated, please use (collection_path: pathlib.Path).
-    # This should be fixed before pytest 9.1, when it becomes ineffective.
-    - if pytest --version | grep -F "pytest 9.0" >/dev/null; then echo "filterwarnings = ignore::pytest.PytestRemovedIn9Warning" >> pytest.ini; fi
     - >
       ("$PYTEST" --junit-xml="$CI_PROJECT_DIR"/junit_pytest.xml -n "$TEST_PARALLEL_JOBS" | tee pytest.out.txt) || RET=1
     - *git_clone_bind9-qa
@@ -981,6 +977,7 @@ cross-version-config-tests:
     untracked: true
     expire_in: "1 day"
     when: always
+  allow_failure: true  # GL!11415
 
 # Jobs for regular GCC builds on Alpine Linux 3.23 (amd64)
 
index c23b459f2f1663075c7d3792b17c54aaf0f789f6..da199018424f2a1acfdb255a9d5660fd56f8f153 100644 (file)
@@ -137,7 +137,7 @@ def pytest_configure(config):
                 config.option.dist = "loadscope"
 
 
-def pytest_ignore_collect(path):
+def pytest_ignore_collect(collection_path):
     # System tests are executed in temporary directories inside
     # bin/tests/system. These temporary directories contain all files
     # needed for the system tests - including tests_*.py files. Make sure to
@@ -146,9 +146,9 @@ def pytest_ignore_collect(path):
     # convenience symlinks to those test directories. In both of those
     # cases, the system test name (directory) contains an underscore, which
     # is otherwise and invalid character for a system test name.
-    match = SYSTEM_TEST_NAME_RE.search(str(path))
+    match = SYSTEM_TEST_NAME_RE.search(str(collection_path))
     if match is None:
-        isctest.log.warning("unexpected test path: %s (ignored)", path)
+        isctest.log.warning("unexpected test path: %s (ignored)", collection_path)
         return True
     system_test_name = match.groups()[0]
     return "_" in system_test_name