changeset 44447:fc70291f3d24

tests: avoid implicit conversion of str to unicode On Python 2, str.encode('ascii') implicitly converts the string to unicode and then back to str. Since the converted value is a path, _bytespath can be used instead.
author Manuel Jacob <me@manueljacob.de>
date Thu, 05 Mar 2020 18:19:21 +0100
parents 109322cd322a
children 55c443fcb4fc
files tests/run-tests.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Thu Mar 05 18:10:19 2020 +0100
+++ b/tests/run-tests.py	Thu Mar 05 18:19:21 2020 +0100
@@ -3008,7 +3008,7 @@
             os.makedirs(self._tmpbindir)
 
             normbin = os.path.normpath(os.path.abspath(whg))
-            normbin = normbin.replace(os.sep.encode('ascii'), b'/')
+            normbin = normbin.replace(_bytespath(os.sep), b'/')
 
             # Other Python scripts in the test harness need to
             # `import mercurial`. If `hg` is a Python script, we assume