1682 num_tests = [0] |
1682 num_tests = [0] |
1683 for test in self._tests: |
1683 for test in self._tests: |
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") |
1691 continue |
1691 continue |
1692 |
1692 |
2260 stdout, stderr = proc.communicate() |
2261 stdout, stderr = proc.communicate() |
2261 args = stdout.strip(b'\0').split(b'\0') |
2262 args = stdout.strip(b'\0').split(b'\0') |
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() |
2273 self._checkhglib("Testing") |
2279 self._checkhglib("Testing") |
2274 else: |
2280 else: |
2302 retest=self.options.retest, |
2308 retest=self.options.retest, |
2303 keywords=kws, |
2309 keywords=kws, |
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 |
2311 runner = TextTestRunner(self, verbosity=verbosity) |
2317 runner = TextTestRunner(self, verbosity=verbosity) |
2312 result = runner.run(suite) |
2318 result = runner.run(suite) |
2349 """Obtain a Test by looking at its filename. |
2355 """Obtain a Test by looking at its filename. |
2350 |
2356 |
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: |
2358 if lctest.endswith(ext): |
2365 if lctest.endswith(ext): |
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, |
2366 keeptmpdir=self.options.keep_tmpdir, |
2373 keeptmpdir=self.options.keep_tmpdir, |
2367 debug=self.options.debug, |
2374 debug=self.options.debug, |