diff options
author | Monty Taylor <mordred@inaugust.com> | 2017-02-28 18:03:53 -0600 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2017-02-28 18:03:53 -0600 |
commit | a05aedac367435f7ee1e15149d7764bcbcc37c69 (patch) | |
tree | b7e6a4534c6d2e702e5113acf951e0fd3c445d57 | |
parent | 36423384654b89fd8d35e53d8486234e6f3e6057 (diff) |
Include the venv path in PATH1.0.5
If a test shells out to a thing installed in the venv, it needs venv/bin
in the path so it can find it.
-rw-r--r-- | ttrun/cmd.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ttrun/cmd.py b/ttrun/cmd.py index a237b1b..b392277 100644 --- a/ttrun/cmd.py +++ b/ttrun/cmd.py | |||
@@ -16,6 +16,7 @@ | |||
16 | # along with Ansible. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with Ansible. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | import argparse | 18 | import argparse |
19 | import os | ||
19 | import subprocess | 20 | import subprocess |
20 | import sys | 21 | import sys |
21 | 22 | ||
@@ -35,11 +36,14 @@ def main(): | |||
35 | args = parse_arguments() | 36 | args = parse_arguments() |
36 | 37 | ||
37 | if args.environment: | 38 | if args.environment: |
38 | return subprocess.call([ | 39 | envpath = '.tox/{environment}/bin'.format(environment=args.environment) |
39 | '.tox/{environment}/bin/python'.format( | 40 | pyexe = '{envpath}/python'.format(envpath=envpath) |
40 | environment=args.environment), | 41 | # Executables in the virtualenv need to be in the path |
41 | '-m', | 42 | os.environ['PATH'] = '{envpath}:{path}'.format( |
42 | 'testtools.run'] + args.tests) | 43 | envpath=envpath, path=os.environ['PATH']) |
44 | return subprocess.Popen( | ||
45 | [pyexe, '-m', 'testtools.run'] + args.tests, | ||
46 | env=os.environ).wait() | ||
43 | else: | 47 | else: |
44 | return testtools.run.main([sys.argv[0]] + args.tests, sys.stdout) | 48 | return testtools.run.main([sys.argv[0]] + args.tests, sys.stdout) |
45 | 49 | ||