tests: hopefully fix `test-doctest.py` on Windows and more
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Mon, 07 Oct 2024 12:08:48 +0100
changeset 52134 479899e53816
parent 52133 f1312d0803a8
child 52135 cf8d029a480b
tests: hopefully fix `test-doctest.py` on Windows and more 1. Shell syntax understood by `shell=True` depends on the platform. Instead, pass `shell=False` and call `sh` explicitly to interpret the command correctly. 2. Stop setting `HGRCPATH=/dev/null`, so the setting `experimental.evolution=createmarkers` is set correctly. The reason I set HGRCPATH to /dev/null previously is because of misunderstanding where I thought the Python script had no HGRC to edit. As it turns out, there is in fact a valid temporary HGRC pointed to by HGRCPATH in this context so we don't seem to need this. /shrug
tests/test-doctest.py
--- a/tests/test-doctest.py	Sat Oct 26 13:56:46 2024 -0400
+++ b/tests/test-doctest.py	Mon Oct 07 12:08:48 2024 +0100
@@ -72,9 +72,13 @@
     sys.exit(0)
 
 files = subprocess.check_output(
-    "HGRCPATH=/dev/null . helpers-testrepo.sh; testrepohg files --print0 \"%s\""
-    % fileset,
-    shell=True,
+    [
+        "sh",
+        "-c",
+        "set -e; . helpers-testrepo.sh; testrepohg files --print0 \"%s\""
+        % fileset,
+    ],
+    shell=False,
     cwd=cwd,
 ).split(b'\0')