Patchwork D4143: tests: fix bytes/str issues in run-tests.py caught by python3

login
register
mail settings
Submitter phabricator
Date Aug. 7, 2018, 12:52 p.m.
Message ID <31a77e66afc433963f7375e7967a5d03@localhost.localdomain>
Download mbox | patch
Permalink /patch/33394/
State Not Applicable
Headers show

Comments

phabricator - Aug. 7, 2018, 12:52 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG35180ade80c1: tests: fix bytes/str issues in run-tests.py caught by python3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4143?vs=10018&id=10045

REVISION DETAIL
  https://phab.mercurial-scm.org/D4143

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1247,8 +1247,8 @@ 
         self._allcases = {x for y in parsettestcases(path) for x in y}
         super(TTest, self).__init__(path, *args, **kwds)
         if case:
-            casepath = _strpath('#'.join(case))
-            self.name = '%s#%s' % (self.name, casepath)
+            casepath = b'#'.join(case)
+            self.name = '%s#%s' % (self.name, _strpath(casepath))
             self.errpath = b'%s#%s.err' % (self.errpath[:-4], casepath)
             self._tmpname += b'-%s' % casepath
         self._have = {}
@@ -1371,7 +1371,7 @@ 
         if os.getenv('MSYSTEM'):
             script.append(b'alias pwd="pwd -W"\n')
         if self._case:
-            casestr = '#'.join(self._case)
+            casestr = b'#'.join(self._case)
             if isinstance(self._case, str):
                 quoted = shellquote(casestr)
             else:
@@ -2680,7 +2680,7 @@ 
                 if m is not None:
                     t, _, casestr = m.groups()
                     if casestr:
-                        case = casestr.split('#')
+                        case = casestr.split(b'#')
                 else:
                     continue
 
@@ -2726,7 +2726,7 @@ 
                     desc = testdescs[0]
                     # desc['path'] is a relative path
                     if 'case' in desc:
-                        casestr = '#'.join(desc['case'])
+                        casestr = b'#'.join(desc['case'])
                         errpath = b'%s#%s.err' % (desc['path'], casestr)
                     else:
                         errpath = b'%s.err' % desc['path']