diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-16 21:49:22 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-16 21:49:22 -0500 |
commit | 0b921d098a92ac44f648aef7bb20695fe7f1986c (patch) | |
tree | 6e764bfdc1282d80c1d1a7404a1d277681b07609 | |
parent | b83728aa983f403be1d9d2847e2babeb2033ce91 (diff) | |
parent | 605735c5afbb865f172e9b30d9174915c16ad1c7 (diff) | |
download | python-coveragepy-git-0b921d098a92ac44f648aef7bb20695fe7f1986c.tar.gz |
Merged in JulianB/coverage.py/coverage3 (pull request #12), and added docs and tests
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | doc/cmd.rst | 7 | ||||
-rw-r--r-- | setup.py | 12 | ||||
-rw-r--r-- | test/test_process.py | 9 |
4 files changed, 25 insertions, 7 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 5141b172..7f77a131 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -27,6 +27,10 @@ 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. + - On Windows, files are now reported in their correct case, fixing `issue 89`_ and `issue 203`_. diff --git a/doc/cmd.rst b/doc/cmd.rst index e8e5f39a..dd11f92f 100644 --- a/doc/cmd.rst +++ b/doc/cmd.rst @@ -21,8 +21,11 @@ Coverage command line usage When you install coverage.py, a command-line script simply called ``coverage`` -is placed in your Python scripts directory. Coverage has a number of commands -which determine the action performed: +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. + +Coverage has a number of commands which determine the action performed: * **run** -- Run a Python program and collect execution data. @@ -74,6 +74,12 @@ else: devstat = "5 - Production/Stable" classifier_list.append("Development Status :: " + devstat) +# Install a script as "coverage", and as "coverage[23]" +scripts = [ + 'coverage = coverage:main', + 'coverage%d = coverage:main' % sys.version_info[0], + ] + # Create the keyword arguments for setup() setup_args = dict( @@ -90,11 +96,7 @@ setup_args = dict( ] }, - entry_points = { - 'console_scripts': [ - 'coverage = coverage:main', - ], - }, + entry_points = {'console_scripts': scripts}, # We need to get HTML assets from our htmlfiles dir. zip_safe = False, diff --git a/test/test_process.py b/test/test_process.py index a67a9c2d..4df8860f 100644 --- a/test/test_process.py +++ b/test/test_process.py @@ -394,6 +394,15 @@ class ProcessTest(CoverageTest): # about 5. self.assertGreater(data.summary()['os.py'], 50) + def test_version_aliases(self): + cmd = "coverage%d" % sys.version_info[0] + out = self.run_command(cmd) + self.assertIn("Code coverage for Python", out) + badcmd = "coverage%d" % (5 - sys.version_info[0]) + out = self.run_command(badcmd) + self.assertNotIn("Code coverage for Python", out) + + class FailUnderTest(CoverageTest): """Tests of the --fail-under switch.""" |