tests: avoid implicit conversion of str to unicode
authorManuel Jacob <me@manueljacob.de>
Thu, 05 Mar 2020 18:19:21 +0100
changeset 44447 fc70291f3d24
parent 44446 109322cd322a
child 44448 55c443fcb4fc
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.
tests/run-tests.py
--- 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