]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Ignore tempdirs during pytest collection phase
authorTom Krizek <tkrizek@isc.org>
Thu, 12 Jan 2023 17:02:39 +0000 (18:02 +0100)
committerTom Krizek <tkrizek@isc.org>
Mon, 22 May 2023 12:11:38 +0000 (14:11 +0200)
bin/tests/system/.gitignore
bin/tests/system/conftest.py

index 822e9114700d6d4fb55fae9b9efb15e1f93de00e..0bbcb233c2864956e07738c699d5c368467b90be 100644 (file)
@@ -19,3 +19,4 @@ named.run
 /start.sh
 /stop.sh
 /ifconfig.sh
+/*_tmp_*
index 4b9dccdc8ece7e0395890bbf2c8b6a4bed201230..f2b5be828bcc6ed6f44f05c8fa26b91ca35004ac 100644 (file)
@@ -156,6 +156,14 @@ if os.getenv("LEGACY_TEST_RUNNER", "0") == "0":
                 raise exc
             logging.debug(proc.stdout)
 
+    def pytest_ignore_collect(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
+        # ignore these during test collection phase. Otherwise, test artifacts
+        # from previous runs could mess with the runner.
+        return "_tmp_" in str(path)
+
     @pytest.hookimpl(tryfirst=True, hookwrapper=True)
     def pytest_runtest_makereport(item):
         """Hook that is used to expose test results to session (for use in fixtures)."""