##// END OF EJS Templates
run-tests: change test identity from a path to a dict...
Jun Wu -
r32310:b96be009 default
parent child Browse files
Show More
@@ -1684,7 +1684,7 b' class TestSuite(unittest.TestSuite):'
1684 def get():
1684 def get():
1685 num_tests[0] += 1
1685 num_tests[0] += 1
1686 if getattr(test, 'should_reload', False):
1686 if getattr(test, 'should_reload', False):
1687 return self._loadtest(test.path, num_tests[0])
1687 return self._loadtest(test, num_tests[0])
1688 return test
1688 return test
1689 if not os.path.exists(test.path):
1689 if not os.path.exists(test.path):
1690 result.addSkip(test, "Doesn't exist")
1690 result.addSkip(test, "Doesn't exist")
@@ -1782,7 +1782,7 b' class TestSuite(unittest.TestSuite):'
1782 if getattr(test, 'should_reload', False):
1782 if getattr(test, 'should_reload', False):
1783 num_tests[0] += 1
1783 num_tests[0] += 1
1784 tests.append(
1784 tests.append(
1785 self._loadtest(test.name, num_tests[0]))
1785 self._loadtest(test, num_tests[0]))
1786 else:
1786 else:
1787 tests.append(test)
1787 tests.append(test)
1788 if self._jobs == 1:
1788 if self._jobs == 1:
@@ -2095,6 +2095,7 b' class TestRunner(object):'
2095 perf = {}
2095 perf = {}
2096 def sortkey(f):
2096 def sortkey(f):
2097 # run largest tests first, as they tend to take the longest
2097 # run largest tests first, as they tend to take the longest
2098 f = f['path']
2098 try:
2099 try:
2099 return perf[f]
2100 return perf[f]
2100 except KeyError:
2101 except KeyError:
@@ -2262,11 +2263,16 b' class TestRunner(object):'
2262 else:
2263 else:
2263 args = os.listdir(b'.')
2264 args = os.listdir(b'.')
2264
2265
2265 return [t for t in args
2266 return [{'path': t} for t in args
2266 if os.path.basename(t).startswith(b'test-')
2267 if os.path.basename(t).startswith(b'test-')
2267 and (t.endswith(b'.py') or t.endswith(b'.t'))]
2268 and (t.endswith(b'.py') or t.endswith(b'.t'))]
2268
2269
2269 def _runtests(self, tests):
2270 def _runtests(self, tests):
2271 def _reloadtest(test, i):
2272 # convert a test back to its description dict
2273 desc = {'path': test.path}
2274 return self._gettest(desc, i)
2275
2270 try:
2276 try:
2271 if self._installdir:
2277 if self._installdir:
2272 self._installhg()
2278 self._installhg()
@@ -2280,7 +2286,7 b' class TestRunner(object):'
2280 if self.options.restart:
2286 if self.options.restart:
2281 orig = list(tests)
2287 orig = list(tests)
2282 while tests:
2288 while tests:
2283 if os.path.exists(tests[0] + ".err"):
2289 if os.path.exists(tests[0]['path'] + ".err"):
2284 break
2290 break
2285 tests.pop(0)
2291 tests.pop(0)
2286 if not tests:
2292 if not tests:
@@ -2304,7 +2310,7 b' class TestRunner(object):'
2304 loop=self.options.loop,
2310 loop=self.options.loop,
2305 runs_per_test=self.options.runs_per_test,
2311 runs_per_test=self.options.runs_per_test,
2306 showchannels=self.options.showchannels,
2312 showchannels=self.options.showchannels,
2307 tests=tests, loadtest=self._gettest)
2313 tests=tests, loadtest=_reloadtest)
2308 verbosity = 1
2314 verbosity = 1
2309 if self.options.verbose:
2315 if self.options.verbose:
2310 verbosity = 2
2316 verbosity = 2
@@ -2351,7 +2357,8 b' class TestRunner(object):'
2351 Returns a Test instance. The Test may not be runnable if it doesn't
2357 Returns a Test instance. The Test may not be runnable if it doesn't
2352 map to a known type.
2358 map to a known type.
2353 """
2359 """
2354 lctest = test.lower()
2360 path = test['path']
2361 lctest = path.lower()
2355 testcls = Test
2362 testcls = Test
2356
2363
2357 for ext, cls in self.TESTTYPES:
2364 for ext, cls in self.TESTTYPES:
@@ -2359,7 +2366,7 b' class TestRunner(object):'
2359 testcls = cls
2366 testcls = cls
2360 break
2367 break
2361
2368
2362 refpath = os.path.join(self._testdir, test)
2369 refpath = os.path.join(self._testdir, path)
2363 tmpdir = os.path.join(self._hgtmp, b'child%d' % count)
2370 tmpdir = os.path.join(self._hgtmp, b'child%d' % count)
2364
2371
2365 t = testcls(refpath, tmpdir,
2372 t = testcls(refpath, tmpdir,
General Comments 0
You need to be logged in to leave comments. Login now