summaryrefslogtreecommitdiff
path: root/tests/coveragetest.py
diff options
context:
space:
mode:
authorBen Finney <ben+python@benfinney.id.au>2015-10-28 16:20:27 +1100
committerBen Finney <ben+python@benfinney.id.au>2015-10-28 16:20:27 +1100
commit52d14cc72e7b888ae4055b4bad5d4ada66cabf2b (patch)
tree257936afbb2cd61e54772dbbf2a9987ca70b477a /tests/coveragetest.py
parent6780b2e89840cd9492190a16c4b767c67d54d09f (diff)
downloadpython-coveragepy-git-52d14cc72e7b888ae4055b4bad5d4ada66cabf2b.tar.gz
Split and re-assemble command line for special handling command name.
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r--tests/coveragetest.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index bf55395e..86f35063 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -352,7 +352,11 @@ class CoverageTest(
Python interpreter.
"""
- if cmd.startswith("python "):
+ split_commandline = cmd.split(" ", 1)
+ command_name = split_commandline[0]
+ command_args = split_commandline[1:]
+
+ if command_name == "python":
# Running a Python interpreter in a sub-processes can be
# tricky. Use the real name of our own executable. So
# "python foo.py" might get executed as "python3.3
@@ -360,9 +364,11 @@ class CoverageTest(
# install as "python", so you might get a Python 2
# executable instead if you don't use the executable's
# basename.
- cmd = os.path.basename(sys.executable) + cmd[6:]
+ command_name = os.path.basename(sys.executable)
+
+ full_commandline = " ".join([shlex.quote(command_name)] + command_args)
- _, output = self.run_command_status(cmd)
+ _, output = self.run_command_status(full_commandline)
return output
def run_command_status(self, cmd):