changeset 46091:af3a6900f893

run-tests: fix `HGTESTEXTRAEXTENSIONS` with py3 Since `extensions` was a str and `section` bytes, it never populated anything. If it had, it would have put bytes into the environment dictionary that is all str. As everything starts and ends as str, remove the incomplete attempt at byteification. It doesn't appear that we had any test coverage of this bit of code, so also add a non-extension config to make sure it is filtered out properly. Differential Revision: https://phab.mercurial-scm.org/D9557
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 09 Dec 2020 12:57:40 -0500
parents 9eb07ab3f2d4
children 08fd76a553c9
files tests/run-tests.py tests/test-run-tests.t
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Dec 04 17:27:10 2020 +0100
+++ b/tests/run-tests.py	Wed Dec 09 12:57:40 2020 -0500
@@ -1364,14 +1364,14 @@
 
         extraextensions = []
         for opt in self._extraconfigopts:
-            section, key = _sys2bytes(opt).split(b'.', 1)
+            section, key = opt.split('.', 1)
             if section != 'extensions':
                 continue
-            name = key.split(b'=', 1)[0]
+            name = key.split('=', 1)[0]
             extraextensions.append(name)
 
         if extraextensions:
-            env['HGTESTEXTRAEXTENSIONS'] = b' '.join(extraextensions)
+            env['HGTESTEXTRAEXTENSIONS'] = ' '.join(extraextensions)
 
         # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw
         # IP addresses.
--- a/tests/test-run-tests.t	Fri Dec 04 17:27:10 2020 +0100
+++ b/tests/test-run-tests.t	Wed Dec 09 12:57:40 2020 -0500
@@ -1956,9 +1956,12 @@
   $ cat << EOF >> test-config-opt.t
   >   $ hg init test-config-opt
   >   $ hg -R test-config-opt purge
+  >   $ echo "HGTESTEXTRAEXTENSIONS: \$HGTESTEXTRAEXTENSIONS"
+  >   HGTESTEXTRAEXTENSIONS: purge
   > EOF
 
-  $ rt --extra-config-opt extensions.purge= test-config-opt.t
+  $ rt --extra-config-opt extensions.purge= \
+  >    --extra-config-opt not.an.extension=True test-config-opt.t
   running 1 tests using 1 parallel processes 
   .
   # Ran 1 tests, 0 skipped, 0 failed.