##// 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 338 # Status code reserved for skipped tests (used by hghave).
339 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 342 """Create a test from parameters.
343 343
344 344 options are parsed command line options that control test execution.
@@ -351,6 +351,9 b' class Test(unittest.TestCase):'
351 351
352 352 abort is a flag that turns to True if test execution should be aborted.
353 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 359 self.path = path
@@ -362,6 +365,7 b' class Test(unittest.TestCase):'
362 365 self._count = count
363 366 self._threadtmp = tmpdir
364 367 self._abort = abort
368 self._keeptmpdir = keeptmpdir
365 369 self._daemonpids = []
366 370
367 371 self._finished = None
@@ -537,7 +541,7 b' class Test(unittest.TestCase):'
537 541 killdaemons(entry)
538 542 self._daemonpids = []
539 543
540 if not self._options.keep_tmpdir:
544 if not self._keeptmpdir:
541 545 shutil.rmtree(self._testtmp, True)
542 546 shutil.rmtree(self._threadtmp, True)
543 547
@@ -1485,7 +1489,8 b' class TestRunner(object):'
1485 1489 refpath = os.path.join(self.testdir, test)
1486 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 1495 def _cleanup(self):
1491 1496 """Clean up state from this test invocation."""
General Comments 0
You need to be logged in to leave comments. Login now