##// END OF EJS Templates
run-tests: pass abort into Test.__init__
Gregory Szorc -
r21505:3a1881db default
parent child Browse files
Show More
@@ -338,7 +338,7 b' class Test(unittest.TestCase):'
338 # Status code reserved for skipped tests (used by hghave).
338 # Status code reserved for skipped tests (used by hghave).
339 SKIPPED_STATUS = 80
339 SKIPPED_STATUS = 80
340
340
341 def __init__(self, runner, path, count, tmpdir):
341 def __init__(self, runner, path, count, tmpdir, abort):
342 """Create a test from parameters.
342 """Create a test from parameters.
343
343
344 runner is a TestRunner instance.
344 runner is a TestRunner instance.
@@ -348,6 +348,9 b' class Test(unittest.TestCase):'
348 count is an identifier used to denote this test instance.
348 count is an identifier used to denote this test instance.
349
349
350 tmpdir is the main temporary directory to use for this test.
350 tmpdir is the main temporary directory to use for this test.
351
352 abort is a flag that turns to True if test execution should be aborted.
353 It is consulted periodically during the execution of tests.
351 """
354 """
352
355
353 self._path = path
356 self._path = path
@@ -359,6 +362,7 b' class Test(unittest.TestCase):'
359 self._options = runner.options
362 self._options = runner.options
360 self._count = count
363 self._count = count
361 self._threadtmp = tmpdir
364 self._threadtmp = tmpdir
365 self._abort = abort
362 self._daemonpids = []
366 self._daemonpids = []
363
367
364 self._finished = None
368 self._finished = None
@@ -684,7 +688,7 b' class PythonTest(Test):'
684 vlog("# Running", cmd)
688 vlog("# Running", cmd)
685 if os.name == 'nt':
689 if os.name == 'nt':
686 replacements.append((r'\r\n', '\n'))
690 replacements.append((r'\r\n', '\n'))
687 return run(cmd, self._testtmp, replacements, env, self._runner.abort,
691 return run(cmd, self._testtmp, replacements, env, self._abort,
688 debug=self._options.debug, timeout=self._options.timeout)
692 debug=self._options.debug, timeout=self._options.timeout)
689
693
690 class TTest(Test):
694 class TTest(Test):
@@ -720,7 +724,7 b' class TTest(Test):'
720 vlog("# Running", cmd)
724 vlog("# Running", cmd)
721
725
722 exitcode, output = run(cmd, self._testtmp, replacements, env,
726 exitcode, output = run(cmd, self._testtmp, replacements, env,
723 self._runner.abort, debug=self._options.debug,
727 self._abort, debug=self._options.debug,
724 timeout=self._options.timeout)
728 timeout=self._options.timeout)
725 # Do not merge output if skipped. Return hghave message instead.
729 # Do not merge output if skipped. Return hghave message instead.
726 # Similarly, with --debug, output is None.
730 # Similarly, with --debug, output is None.
@@ -1471,7 +1475,7 b' class TestRunner(object):'
1471 refpath = os.path.join(self.testdir, test)
1475 refpath = os.path.join(self.testdir, test)
1472 tmpdir = os.path.join(self.hgtmp, 'child%d' % count)
1476 tmpdir = os.path.join(self.hgtmp, 'child%d' % count)
1473
1477
1474 return testcls(self, refpath, count, tmpdir)
1478 return testcls(self, refpath, count, tmpdir, self.abort)
1475
1479
1476 def _cleanup(self):
1480 def _cleanup(self):
1477 """Clean up state from this test invocation."""
1481 """Clean up state from this test invocation."""
General Comments 0
You need to be logged in to leave comments. Login now