summaryrefslogtreecommitdiff
path: root/tests/coveragetest.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-10-05 14:36:44 -0400
committerNed Batchelder <ned@nedbatchelder.com>2013-10-05 14:36:44 -0400
commit9bb2dc364c54ee72d02993f534532fce524bcdef (patch)
tree590d53929a3ba5155e23baf9d133b8cd1b239eb7 /tests/coveragetest.py
parent7599c0d495353607155f336c8c7a9850f8ad4f55 (diff)
downloadpython-coveragepy-git-9bb2dc364c54ee72d02993f534532fce524bcdef.tar.gz
Can't just run 'python' in a subprocess from 3.x, since it doesn't install as 'python'.
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r--tests/coveragetest.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index 1cefb6e3..9f7c79c9 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -452,6 +452,14 @@ class CoverageTest(TestCase):
Returns the process' stdout text.
"""
+ # Running Python subprocesses can be tricky. Use the real name of our
+ # own executable. So "python foo.py" might get executed as
+ # "python3.3 foo.py". This is important because Python 3.x doesn't
+ # install as "python", so you might get a Python 2 executable instead
+ # if you don't use the executable's basename.
+ if cmd.startswith("python "):
+ cmd = os.path.basename(sys.executable) + cmd[6:]
+
_, output = self.run_command_status(cmd)
return output