diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-07-06 08:55:33 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-07-06 08:55:33 +0100 |
commit | a6fb61972ccc6c790f2ec45f12eca770419b6e80 (patch) | |
tree | 80faf60af6ad147129ba10683bb04203b5942ef1 /yarn | |
parent | 4747bbd187d27fabef1e9514ebcec584980400e3 (diff) | |
download | cmdtest-a6fb61972ccc6c790f2ec45f12eca770419b6e80.tar.gz |
Add --tempdir option
Diffstat (limited to 'yarn')
-rwxr-xr-x | yarn | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -50,6 +50,12 @@ class YarnRunner(cliapp.Application): 'run only TEST (this option can be repeated)', metavar='TEST') + self.settings.string( + ['tempdir'], + 'use DIR as the temporary directory for tests; ' + 'it should be empty or not exist', + metavar='DIR') + def setup(self): self.ts = ttystatus.TerminalStatus(period=0.001) if not self.settings['quiet']: @@ -170,7 +176,14 @@ class YarnRunner(cliapp.Application): if self.settings['no-act']: return True - datadir = tempfile.mkdtemp() + if self.settings['tempdir']: + tempdir = self.settings['tempdir'] + if not os.path.exists(tempdir): + os.mkdir(tempdir) + else: + tempdir = tempfile.mkdtemp() + datadir = os.path.join(tempdir, 'datadir') + os.mkdir(datadir) cleanup = [s for s in scenario.steps if s.what == 'FINALLY'] normal = [s for s in scenario.steps if s not in cleanup] |