summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-07-06 08:55:33 +0100
committerLars Wirzenius <liw@liw.fi>2013-07-06 08:55:33 +0100
commita6fb61972ccc6c790f2ec45f12eca770419b6e80 (patch)
tree80faf60af6ad147129ba10683bb04203b5942ef1
parent4747bbd187d27fabef1e9514ebcec584980400e3 (diff)
downloadcmdtest-a6fb61972ccc6c790f2ec45f12eca770419b6e80.tar.gz
Add --tempdir option
-rwxr-xr-xyarn15
1 files changed, 14 insertions, 1 deletions
diff --git a/yarn b/yarn
index e3ed242..224fd88 100755
--- a/yarn
+++ b/yarn
@@ -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]