diff options
-rw-r--r-- | doc/cmd.rst | 8 | ||||
-rw-r--r-- | tests/test_process.py | 25 |
2 files changed, 16 insertions, 17 deletions
diff --git a/doc/cmd.rst b/doc/cmd.rst index 76ef9dbf..ed86e28a 100644 --- a/doc/cmd.rst +++ b/doc/cmd.rst @@ -32,10 +32,10 @@ Command line usage When you install coverage.py, a command-line script called ``coverage`` is placed on your path. To help with multi-version installs, it will also create -either a ``coverage2`` or ``coverage3`` alias, and a ``coverage-X.Y`` alias, -depending on the version of Python you're using. For example, when installing -on Python 3.7, you will be able to use ``coverage``, ``coverage3``, or -``coverage-3.7`` on the command line. +a ``coverage3`` alias, and a ``coverage-X.Y`` alias, depending on the version +of Python you're using. For example, when installing on Python 3.7, you will +be able to use ``coverage``, ``coverage3``, or ``coverage-3.7`` on the command +line. Coverage.py has a number of commands: diff --git a/tests/test_process.py b/tests/test_process.py index fdd71f0f..8bbfe99c 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -983,34 +983,33 @@ class AliasedCommandTest(CoverageTest): run_in_temp_dir = False def test_major_version_works(self): - # "coverage2" works on py2 + # "coverage3" works on py3 cmd = "coverage%d" % sys.version_info[0] out = self.run_command(cmd) assert "Code coverage for Python" in out def test_wrong_alias_doesnt_work(self): - # "coverage3" doesn't work on py2 + # "coverage2" doesn't work on py3 assert sys.version_info[0] in [2, 3] # Let us know when Python 4 is out... badcmd = "coverage%d" % (5 - sys.version_info[0]) out = self.run_command(badcmd) assert "Code coverage for Python" not in out def test_specific_alias_works(self): - # "coverage-2.7" works on py2.7 + # "coverage-3.9" works on py3.9 cmd = "coverage-%d.%d" % sys.version_info[:2] out = self.run_command(cmd) assert "Code coverage for Python" in out - def test_aliases_used_in_messages(self): - cmds = [ - "coverage", - "coverage%d" % sys.version_info[0], - "coverage-%d.%d" % sys.version_info[:2], - ] - for cmd in cmds: - out = self.run_command(f"{cmd} foobar") - assert "Unknown command: 'foobar'" in out - assert f"Use '{cmd} help' for help" in out + @pytest.mark.parametrize("cmd", [ + "coverage", + "coverage%d" % sys.version_info[0], + "coverage-%d.%d" % sys.version_info[:2], + ]) + def test_aliases_used_in_messages(self, cmd): + out = self.run_command(f"{cmd} foobar") + assert "Unknown command: 'foobar'" in out + assert f"Use '{cmd} help' for help" in out class PydocTest(CoverageTest): |