diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-08-25 14:11:50 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-08-25 14:12:03 +0100 |
commit | 3573f2213988fdc477d3cbf123981f7397f42cdb (patch) | |
tree | d89c9be6f462a5b47a8af129441c68c39cea30d2 /yarn | |
parent | 1dbacde0bfa4463434abe3ecbccd2c03a29a3c16 (diff) | |
download | cmdtest-3573f2213988fdc477d3cbf123981f7397f42cdb.tar.gz |
Add --env option
Suggested by Daniel Silverstone
Diffstat (limited to 'yarn')
-rwxr-xr-x | yarn | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -64,6 +64,11 @@ class YarnRunner(cliapp.Application): 'it should be empty or not exist', metavar='DIR') + self.settings.string_list( + ['env'], + 'add NAME=VALUE to the environment when tests are run', + metavar='NAME=VALUE') + self.settings.boolean( ['snapshot'], 'make snapshots of test working directory ' @@ -340,11 +345,22 @@ class YarnRunner(cliapp.Application): } env = {} + for key in whitelisted: if key in os.environ: env[key] = os.environ[key] + for key in hardcoded: env[key] = hardcoded[key] + + for option_arg in self.settings['env']: + if '=' not in option_arg: + raise cliapp.AppException( + '--env argument must contain "=" ' + 'to separate environment variable name and value') + key, value = option_arg.split('=', 1) + env[key] = value + return env def run_step(self, datadir, scenario, step, shell_prelude, report_error): |