run-tests: configure the environment to expand `~` properly with Windows py38+
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 09 Dec 2020 15:50:59 -0500
changeset 46092 08fd76a553c9
parent 46091 af3a6900f893
child 46093 224af78021de
run-tests: configure the environment to expand `~` properly with Windows py38+ This was causing tests to point to the actual home path on the system, not the test defined one. Differential Revision: https://phab.mercurial-scm.org/D9558
tests/run-tests.py
tests/test-template-map.t
--- a/tests/run-tests.py	Wed Dec 09 12:57:40 2020 -0500
+++ b/tests/run-tests.py	Wed Dec 09 15:50:59 2020 -0500
@@ -1335,6 +1335,9 @@
         env['TESTTMP'] = _bytes2sys(self._testtmp)
         env['TESTNAME'] = self.name
         env['HOME'] = _bytes2sys(self._testtmp)
+        if os.name == 'nt':
+            # py3.8+ ignores HOME: https://bugs.python.org/issue36264
+            env['USERPROFILE'] = env['HOME']
         formated_timeout = _bytes2sys(b"%d" % default_defaults['timeout'][1])
         env['HGTEST_TIMEOUT_DEFAULT'] = formated_timeout
         env['HGTEST_TIMEOUT'] = _bytes2sys(b"%d" % self._timeout)
--- a/tests/test-template-map.t	Wed Dec 09 12:57:40 2020 -0500
+++ b/tests/test-template-map.t	Wed Dec 09 15:50:59 2020 -0500
@@ -1972,6 +1972,7 @@
   > EOF
 
   $ HOME=`pwd`/home; export HOME
+  $ USERPROFILE=`pwd`/home; export USERPROFILE
 
   $ cat > latesttag/.hg/hgrc <<EOF
   > [ui]