diff options
-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 | ||