summaryrefslogtreecommitdiff
path: root/cmdtest
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-08-22 17:20:03 +0100
committerLars Wirzenius <liw@liw.fi>2011-08-22 17:20:03 +0100
commit81fab08682f9f442027021551403636943a0fa28 (patch)
treef30fc2926a65f8a2d30c17490d3ec725dbe8c7b6 /cmdtest
parent3440a71bc3a9193c6ce48f30c58055b74c7c3e1c (diff)
downloadcmdtest-81fab08682f9f442027021551403636943a0fa28.tar.gz
Run foo.script instead of using foo.args, when script exists.
Diffstat (limited to 'cmdtest')
-rwxr-xr-xcmdtest10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmdtest b/cmdtest
index f2757f9..4d9f183 100755
--- a/cmdtest
+++ b/cmdtest
@@ -101,6 +101,7 @@ class CommandTester(cliapp.Application):
def add_to_env(self):
env = dict(os.environ)
env['DATADIR'] = self.datadir
+ env['COMMAND'] = self.settings['command']
return env
def run_test(self, test):
@@ -108,9 +109,12 @@ class CommandTester(cliapp.Application):
self.run_script(test.setup)
- argv = [self.settings['command']]
- if test.args:
- argv.extend(self.expand(self.lines(test.args)))
+ if test.script:
+ argv = [test.script]
+ else:
+ argv = [self.settings['command']]
+ if test.args:
+ argv.extend(self.expand(self.lines(test.args)))
stdin = self.cat(test.stdin or '/dev/null')
exit, out, err = self.runcmd_unchecked(argv,