Comments
Patch
@@ -1690,5 +1690,5 @@ class TestSuite(unittest.TestSuite):
num_tests[0] += 1
if getattr(test, 'should_reload', False):
- return self._loadtest(test.path, num_tests[0])
+ return self._loadtest(test, num_tests[0])
return test
if not os.path.exists(test.path):
@@ -1788,5 +1788,5 @@ class TestSuite(unittest.TestSuite):
num_tests[0] += 1
tests.append(
- self._loadtest(test.name, num_tests[0]))
+ self._loadtest(test, num_tests[0]))
else:
tests.append(test)
@@ -2101,4 +2101,5 @@ class TestRunner(object):
def sortkey(f):
# run largest tests first, as they tend to take the longest
+ f = f['path']
try:
return perf[f]
@@ -2268,9 +2269,14 @@ class TestRunner(object):
args = os.listdir(b'.')
- return [t for t in args
+ return [{'path': t} for t in args
if os.path.basename(t).startswith(b'test-')
and (t.endswith(b'.py') or t.endswith(b'.t'))]
def _runtests(self, tests):
+ def _reloadtest(test, i):
+ # convert a test back to its description dict
+ desc = {'path': test.path}
+ return self._gettest(desc, i)
+
try:
if self._installdir:
@@ -2286,5 +2292,5 @@ class TestRunner(object):
orig = list(tests)
while tests:
- if os.path.exists(tests[0] + ".err"):
+ if os.path.exists(tests[0]['path'] + ".err"):
break
tests.pop(0)
@@ -2310,5 +2316,5 @@ class TestRunner(object):
runs_per_test=self.options.runs_per_test,
showchannels=self.options.showchannels,
- tests=tests, loadtest=self._gettest)
+ tests=tests, loadtest=_reloadtest)
verbosity = 1
if self.options.verbose:
@@ -2357,5 +2363,6 @@ class TestRunner(object):
map to a known type.
"""
- lctest = test.lower()
+ path = test['path']
+ lctest = path.lower()
testcls = Test
@@ -2365,5 +2372,5 @@ class TestRunner(object):
break
- refpath = os.path.join(self._testdir, test)
+ refpath = os.path.join(self._testdir, path)
tmpdir = os.path.join(self._hgtmp, b'child%d' % count)