# HG changeset patch # User Manuel Jacob # Date 2020-03-05 17:19:21 # Node ID fc70291f3d24433f3d4bd936c84191702ff74235 # Parent 109322cd322a708200d5d191ebce9f01f2582961 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. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -3008,7 +3008,7 @@ class TestRunner(object): 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