summaryrefslogtreecommitdiff
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
commit45302c9b9e9d645ad600fbeb3594bbbd3ea8e6bf (patch)
tree0f5565602491222fbdaac9b32a7f95e82b18c19b
parent197bf847c8d6f63d5a060e7306905f1ff5968a81 (diff)
downloadpython-coveragepy-45302c9b9e9d645ad600fbeb3594bbbd3ea8e6bf.tar.gz
Split and re-assemble command line for special handling command name.
-rw-r--r--tests/coveragetest.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index bf55395..86f3506 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):