##// END OF EJS Templates
run-tests: factor options.keep_tmpdir into an argument to Test.__init__
Gregory Szorc -
r21509:d21d53ee 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, options, path, count, tmpdir, abort):
341 def __init__(self, options, path, count, tmpdir, abort, keeptmpdir=False):
342 """Create a test from parameters.
342 """Create a test from parameters.
343
343
344 options are parsed command line options that control test execution.
344 options are parsed command line options that control test execution.
@@ -351,6 +351,9 b' class Test(unittest.TestCase):'
351
351
352 abort is a flag that turns to True if test execution should be aborted.
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.
353 It is consulted periodically during the execution of tests.
354
355 keeptmpdir determines whether to keep the test's temporary directory
356 after execution. It defaults to removal (False).
354 """
357 """
355
358
356 self.path = path
359 self.path = path
@@ -362,6 +365,7 b' class Test(unittest.TestCase):'
362 self._count = count
365 self._count = count
363 self._threadtmp = tmpdir
366 self._threadtmp = tmpdir
364 self._abort = abort
367 self._abort = abort
368 self._keeptmpdir = keeptmpdir
365 self._daemonpids = []
369 self._daemonpids = []
366
370
367 self._finished = None
371 self._finished = None
@@ -537,7 +541,7 b' class Test(unittest.TestCase):'
537 killdaemons(entry)
541 killdaemons(entry)
538 self._daemonpids = []
542 self._daemonpids = []
539
543
540 if not self._options.keep_tmpdir:
544 if not self._keeptmpdir:
541 shutil.rmtree(self._testtmp, True)
545 shutil.rmtree(self._testtmp, True)
542 shutil.rmtree(self._threadtmp, True)
546 shutil.rmtree(self._threadtmp, True)
543
547
@@ -1485,7 +1489,8 b' class TestRunner(object):'
1485 refpath = os.path.join(self.testdir, test)
1489 refpath = os.path.join(self.testdir, test)
1486 tmpdir = os.path.join(self.hgtmp, 'child%d' % count)
1490 tmpdir = os.path.join(self.hgtmp, 'child%d' % count)
1487
1491
1488 return testcls(self.options, refpath, count, tmpdir, self.abort)
1492 return testcls(self.options, refpath, count, tmpdir, self.abort,
1493 keeptmpdir=self.options.keep_tmpdir)
1489
1494
1490 def _cleanup(self):
1495 def _cleanup(self):
1491 """Clean up state from this test invocation."""
1496 """Clean up state from this test invocation."""
General Comments 0
You need to be logged in to leave comments. Login now