diff options
author | Ben Finney <ben+python@benfinney.id.au> | 2015-10-28 16:23:40 +1100 |
---|---|---|
committer | Ben Finney <ben+python@benfinney.id.au> | 2015-10-28 16:23:40 +1100 |
commit | 408ac057b0b4c178ff487e709c3fe6c6031a5c38 (patch) | |
tree | 2bea6051e3a55a842f4c4520fb5d61d633e66e10 | |
parent | 45302c9b9e9d645ad600fbeb3594bbbd3ea8e6bf (diff) | |
download | python-coveragepy-408ac057b0b4c178ff487e709c3fe6c6031a5c38.tar.gz |
Replace ?coverage? command with actual Coverage.py command name.
-rw-r--r-- | tests/coveragetest.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py index 86f3506..8357f10 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -334,6 +334,8 @@ class CoverageTest( ret_actual = script.command_line(shlex.split(args)) self.assertEqual(ret_actual, ret) + coverage_command = "coverage" + def run_command(self, cmd): """ Run the command-line `cmd` in a sub-process. @@ -351,6 +353,9 @@ class CoverageTest( * "python" is replaced with the command name of the current Python interpreter. + * "coverage" is replaced with the command name for the main + Coverage.py program. + """ split_commandline = cmd.split(" ", 1) command_name = split_commandline[0] @@ -365,6 +370,13 @@ class CoverageTest( # executable instead if you don't use the executable's # basename. command_name = os.path.basename(sys.executable) + + if command_name == "coverage": + # The invocation requests the Coverage.py program. Test + # whether that's actually the command name to use. + if command_name != self.coverage_command: + # Substitute the actual Coverage.py main command name. + command_name = self.coverage_command full_commandline = " ".join([shlex.quote(command_name)] + command_args) |