summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt9
-rw-r--r--doc/cmd.rst4
-rw-r--r--setup.py6
-rw-r--r--test/test_process.py16
4 files changed, 28 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 7f77a131..bc54896e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -27,9 +27,11 @@ Version 3.5.4b1
- Embarrassingly, the `[xml] output=' setting in the .coveragerc file simply
didn't work. Now it does.
-- When installing, now in addition to creating a "coverage" command, a
- "coverage2" or "coverage3" command will be created, depending on whether you
- are installing in Python 2.x or 3.x. Thanks, Julian Berman.
+- When installing, now in addition to creating a "coverage" command, two new
+ aliases are also installed. A "coverage2" or "coverage3" command will be
+ created, depending on whether you are installing in Python 2.x or 3.x.
+ A "coverage-X.Y" command will also be created corresponding to your specific
+ version of Python. Closes `issue 111`.
- On Windows, files are now reported in their correct case, fixing `issue 89`_
and `issue 203`_.
@@ -56,6 +58,7 @@ Version 3.5.4b1
- Other minor bugs fixed: `issue 153`_.
.. _issue 89: https://bitbucket.org/ned/coveragepy/issue/89/on-windows-all-packages-are-reported-in
+.. _issue 111: https://bitbucket.org/ned/coveragepy/issue/111/when-installing-coverage-with-pip-not
.. _issue 139: https://bitbucket.org/ned/coveragepy/issue/139/easy-check-for-a-certain-coverage-in-tests
.. _issue 143: https://bitbucket.org/ned/coveragepy/issue/143/omit-doesnt-seem-to-work-in-coverage
.. _issue 153: https://bitbucket.org/ned/coveragepy/issue/153/non-existent-filename-triggers
diff --git a/doc/cmd.rst b/doc/cmd.rst
index dd11f92f..7171ec51 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -23,7 +23,9 @@ Coverage command line usage
When you install coverage.py, a command-line script simply called ``coverage``
is placed in your Python scripts directory. To help with multi-version
installs, it will also create either a ``coverage2`` or ``coverage3`` alias,
-depending on the version of Python you're using.
+and a ``coverage-X.Y`` alias, depending on the version of Python you're using.
+For example, when installing on Python 2.7, you will be able to use
+``coverage``, ``coverage2``, or ``coverage-2.7`` on the command line.
Coverage has a number of commands which determine the action performed:
diff --git a/setup.py b/setup.py
index c8527819..69a60a87 100644
--- a/setup.py
+++ b/setup.py
@@ -74,10 +74,12 @@ else:
devstat = "5 - Production/Stable"
classifier_list.append("Development Status :: " + devstat)
-# Install a script as "coverage", and as "coverage[23]"
+# Install a script as "coverage", and as "coverage[23]", and as
+# "coverage-2.7" (or whatever).
scripts = [
'coverage = coverage:main',
- 'coverage%d = coverage:main' % sys.version_info[0],
+ 'coverage%d = coverage:main' % sys.version_info[:1],
+ 'coverage-%d.%d = coverage:main' % sys.version_info[:2],
]
# Create the keyword arguments for setup()
diff --git a/test/test_process.py b/test/test_process.py
index 4df8860f..2d926038 100644
--- a/test/test_process.py
+++ b/test/test_process.py
@@ -394,14 +394,28 @@ class ProcessTest(CoverageTest):
# about 5.
self.assertGreater(data.summary()['os.py'], 50)
- def test_version_aliases(self):
+
+class AliasedCommandTests(CoverageTest):
+ """Tests of the version-specific command aliases."""
+
+ def test__major_version_works(self):
+ # "coverage2" works on py2
cmd = "coverage%d" % sys.version_info[0]
out = self.run_command(cmd)
self.assertIn("Code coverage for Python", out)
+
+ def test_wrong_alias_doesnt_work(self):
+ # "coverage3" doesn't work on py2
badcmd = "coverage%d" % (5 - sys.version_info[0])
out = self.run_command(badcmd)
self.assertNotIn("Code coverage for Python", out)
+ def test_specific_alias_works(self):
+ # "coverage-2.7" works on py2.7
+ cmd = "coverage-%d.%d" % sys.version_info[:2]
+ out = self.run_command(cmd)
+ self.assertIn("Code coverage for Python", out)
+
class FailUnderTest(CoverageTest):
"""Tests of the --fail-under switch."""