Mercurial > public > mercurial-scm > hg-stable
diff tests/run-tests.py @ 33736:2e43c5cd57a7
tests: fix up test-run-tests failures on Python 3.6
Some of the recent work on run-tests.py didn't work on Python 3. This
fixes the regressions.
Differential Revision: https://phab.mercurial-scm.org/D270
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 08 Aug 2017 15:07:05 -0400 |
parents | 1fa6023240f4 |
children | 81b12f69ef5b |
line wrap: on
line diff
--- a/tests/run-tests.py Wed Aug 02 11:32:25 2017 +0200 +++ b/tests/run-tests.py Tue Aug 08 15:07:05 2017 -0400 @@ -105,9 +105,13 @@ PYTHON3 = True xrange = range # we use xrange in one place, and we'd rather not use range def _bytespath(p): + if p is None: + return p return p.encode('utf-8') def _strpath(p): + if p is None: + return p return p.decode('utf-8') elif sys.version_info >= (3, 0, 0): @@ -1383,7 +1387,8 @@ else: m = optline.match(el) if m: - conditions = [c for c in m.group(2).split(' ')] + conditions = [ + c for c in m.group(2).split(b' ')] if not self._hghave(conditions)[0]: optional.append(i) @@ -1497,7 +1502,7 @@ else: m = optline.match(el) if m: - conditions = [c for c in m.group(2).split(' ')] + conditions = [c for c in m.group(2).split(b' ')] el = m.group(1) + b"\n" if not self._hghave(conditions)[0]: