comparison tests/run-tests.py @ 33710: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
comparison
equal deleted inserted replaced
33709:511d6ae462f3 33710:2e43c5cd57a7
103 103
104 if sys.version_info > (3, 5, 0): 104 if sys.version_info > (3, 5, 0):
105 PYTHON3 = True 105 PYTHON3 = True
106 xrange = range # we use xrange in one place, and we'd rather not use range 106 xrange = range # we use xrange in one place, and we'd rather not use range
107 def _bytespath(p): 107 def _bytespath(p):
108 if p is None:
109 return p
108 return p.encode('utf-8') 110 return p.encode('utf-8')
109 111
110 def _strpath(p): 112 def _strpath(p):
113 if p is None:
114 return p
111 return p.decode('utf-8') 115 return p.decode('utf-8')
112 116
113 elif sys.version_info >= (3, 0, 0): 117 elif sys.version_info >= (3, 0, 0):
114 print('%s is only supported on Python 3.5+ and 2.7, not %s' % 118 print('%s is only supported on Python 3.5+ and 2.7, not %s' %
115 (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))) 119 (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3])))
1381 if el.endswith(b" (?)\n"): 1385 if el.endswith(b" (?)\n"):
1382 optional.append(i) 1386 optional.append(i)
1383 else: 1387 else:
1384 m = optline.match(el) 1388 m = optline.match(el)
1385 if m: 1389 if m:
1386 conditions = [c for c in m.group(2).split(' ')] 1390 conditions = [
1391 c for c in m.group(2).split(b' ')]
1387 1392
1388 if not self._hghave(conditions)[0]: 1393 if not self._hghave(conditions)[0]:
1389 optional.append(i) 1394 optional.append(i)
1390 1395
1391 i += 1 1396 i += 1
1495 retry = "retry" 1500 retry = "retry"
1496 el = el[:-5] + b"\n" 1501 el = el[:-5] + b"\n"
1497 else: 1502 else:
1498 m = optline.match(el) 1503 m = optline.match(el)
1499 if m: 1504 if m:
1500 conditions = [c for c in m.group(2).split(' ')] 1505 conditions = [c for c in m.group(2).split(b' ')]
1501 1506
1502 el = m.group(1) + b"\n" 1507 el = m.group(1) + b"\n"
1503 if not self._hghave(conditions)[0]: 1508 if not self._hghave(conditions)[0]:
1504 retry = "retry" # Not required by listed features 1509 retry = "retry" # Not required by listed features
1505 1510