Mercurial > hg
changeset 21504:888a5dfe1569
run-tests: pass temp dir into Test.__init__
This patch starts a mini series of moving arguments to Test.__init__
from semi-complex data structures (such as the command options) to named
arguments. This will allow Test instances to be more easily instantiated
from other contexts. This improves the ability to run Mercurial tests in
new and different environments.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 22 Apr 2014 10:05:32 -0700 |
parents | 10f15e34d86c |
children | 3a1881dbf860 |
files | tests/run-tests.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Mar 07 14:17:56 2013 +1100 +++ b/tests/run-tests.py Tue Apr 22 10:05:32 2014 -0700 @@ -338,7 +338,7 @@ # Status code reserved for skipped tests (used by hghave). SKIPPED_STATUS = 80 - def __init__(self, runner, path, count): + def __init__(self, runner, path, count, tmpdir): """Create a test from parameters. runner is a TestRunner instance. @@ -346,6 +346,8 @@ path is the full path to the file defining the test. count is an identifier used to denote this test instance. + + tmpdir is the main temporary directory to use for this test. """ self._path = path @@ -356,6 +358,7 @@ self._runner = runner self._options = runner.options self._count = count + self._threadtmp = tmpdir self._daemonpids = [] self._finished = None @@ -375,8 +378,6 @@ else: self._refout = [] - self._threadtmp = os.path.join(runner.hgtmp, 'child%d' % count) - def __str__(self): return self.name @@ -1467,7 +1468,10 @@ testcls = cls break - return testcls(self, os.path.join(self.testdir, test), count) + refpath = os.path.join(self.testdir, test) + tmpdir = os.path.join(self.hgtmp, 'child%d' % count) + + return testcls(self, refpath, count, tmpdir) def _cleanup(self): """Clean up state from this test invocation."""