]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Rename convenience symlink to pytest artifacts
authorTom Krizek <tkrizek@isc.org>
Tue, 19 Sep 2023 15:20:32 +0000 (17:20 +0200)
committerTom Krizek <tkrizek@isc.org>
Wed, 20 Sep 2023 14:04:40 +0000 (16:04 +0200)
The previous symlink name convention was prone to name collisions If a
system test contained both a shell test and a pytest module of the same
name (e.g. dnstap test has both tests.sh and tests_dnstap.py), then
these would have the same convenience symlink, which could cause test
setup issues as well as confusion when examining test artifacts.

Update the naming convention to include the full pytest module name.
This results in a slightly more verbose names for shell tests (e.g.
dnstap_sh_dnstap instead of the previous dnstap_dnstap), but it removes
the chance of a collision.

(cherry picked from commit fd13dfb0972d775c84378e6f102ffb636279ef93)

bin/tests/system/conftest.py

index 7a3e167936a5b39e4c7ca5a553f0d8701e3e9a54..c8eef007a74099a264e2a454775458ccd2e2bc90 100644 (file)
@@ -63,7 +63,7 @@ PRIORITY_TESTS_RE = re.compile("|".join(PRIORITY_TESTS))
 CONFTEST_LOGGER = logging.getLogger("conftest")
 SYSTEM_TEST_DIR_GIT_PATH = "bin/tests/system"
 SYSTEM_TEST_NAME_RE = re.compile(f"{SYSTEM_TEST_DIR_GIT_PATH}" + r"/([^/]+)")
-SYMLINK_REPLACEMENT_RE = re.compile(r"/tests(_sh(?=_))?(.*)\.py")
+SYMLINK_REPLACEMENT_RE = re.compile(r"/tests(_.*)\.py")
 
 # ---------------------- Module initialization ---------------------------
 
@@ -419,7 +419,7 @@ def system_test_dir(
     shutil.copytree(system_test_root / system_test_name, testdir)
 
     # Create a convenience symlink with a stable and predictable name
-    module_name = SYMLINK_REPLACEMENT_RE.sub(r"\2", request.node.name)
+    module_name = SYMLINK_REPLACEMENT_RE.sub(r"\1", request.node.name)
     symlink_dst = system_test_root / module_name
     unlink(symlink_dst)
     symlink_dst.symlink_to(os.path.relpath(testdir, start=system_test_root))