changeset 51958:16574ca8b155 stable

test: preserve the existing module policy config for testrepohg resuse The test runner is, righfully, setting HGMODULEPOLICY to match the flavor requests to run the tests. However this mess with the `testrepohg` ability to run properly, as the newly set policy might be incompatible with its installation, or its ability to read the test repo. So we preserve the initial value in a dedicated variable and use it in the `testrepohg` helper.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 08 Oct 2024 15:54:59 +0200
parents f3bef5eb12f9
children 88715d0bef8d
files tests/helpers-testrepo.sh tests/run-tests.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/helpers-testrepo.sh	Tue Oct 08 15:54:59 2024 +0200
+++ b/tests/helpers-testrepo.sh	Tue Oct 08 15:54:59 2024 +0200
@@ -29,6 +29,12 @@
     . "$HGTEST_RESTOREENV"
     HGPLAIN=1
     export HGPLAIN
+    if [ -n "$HGTEST_BASE_HGMODULEPOLICY" ]; then
+        HGMODULEPOLICY="$HGTEST_BASE_HGMODULEPOLICY"
+    else
+        unset HGMODULEPOLICY
+    fi
+    export HGMODULEPOLICY
 }
 
 # The test-repo is a live hg repository which may have evolution markers
--- a/tests/run-tests.py	Tue Oct 08 15:54:59 2024 +0200
+++ b/tests/run-tests.py	Tue Oct 08 15:54:59 2024 +0200
@@ -223,6 +223,7 @@
 # For Windows support
 wifexited = getattr(os, "WIFEXITED", lambda x: False)
 
+
 # Whether to use IPv6
 def checksocketfamily(name, port=20058):
     """return true if we can listen on localhost using family=name
@@ -3307,6 +3308,10 @@
             pypath.append(oldpypath)
         osenvironb[IMPL_PATH] = sepb.join(pypath)
 
+        os.environ["HGTEST_BASE_HGMODULEPOLICY"] = os.environ.get(
+            "HGMODULEPOLICY", ""
+        )
+
         if self.options.pure:
             os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure"
             os.environ["HGMODULEPOLICY"] = "py"
@@ -3397,7 +3402,6 @@
                 os.path.basename(t).startswith(b'test-')
                 and (t.endswith(b'.py') or t.endswith(b'.t'))
             ):
-
                 m = testcasepattern.match(os.path.basename(t))
                 if m is not None:
                     t_basename, casestr = m.groups()