summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-06-29 20:48:38 -0400
committerNed Batchelder <ned@nedbatchelder.com>2020-06-29 20:48:38 -0400
commitd00f254315ef4e97e86e230c448d6325c97e08dc (patch)
tree0bb8ebb4394b7fc65b1989256056cec18101b01b
parent2c6c421dbee26b138a4b84738057001d646cb7dc (diff)
downloadpython-coveragepy-git-d00f254315ef4e97e86e230c448d6325c97e08dc.tar.gz
Simplify testing of --no-skip-covered, and add docs
-rw-r--r--CHANGES.rst6
-rw-r--r--doc/cmd.rst3
-rw-r--r--tests/test_cmdline.py10
-rw-r--r--tests/test_summary.py30
4 files changed, 18 insertions, 31 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 44d80835..a68a0f06 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -32,6 +32,10 @@ Unreleased
``--precision`` option to control the number of decimal points displayed.
Thanks, Teake Nutma (`pull request 982`_).
+- The ``coverage report`` command now accepts a ``--no-skip-covered`` option
+ to negate ``--skip-covered``. Thanks, Anthony Sottile (`issue 779`_ and
+ `pull request 932`_).
+
- If coverage fails due to the coverage total not reaching the ``--fail-under``
value, it will now print a message making the condition clear. Thanks,
Naveen Yadav (`pull request 977`_).
@@ -44,8 +48,10 @@ Unreleased
considered.
.. _pull request 931: https://github.com/nedbat/coveragepy/pull/931
+.. _pull request 932: https://github.com/nedbat/coveragepy/pull/932
.. _pull request 977: https://github.com/nedbat/coveragepy/pull/977
.. _pull request 982: https://github.com/nedbat/coveragepy/pull/982
+.. _issue 779: https://github.com/nedbat/coveragepy/issues/779
.. _issue 858: https://github.com/nedbat/coveragepy/issues/858
.. _issue 990: https://github.com/nedbat/coveragepy/issues/990
diff --git a/doc/cmd.rst b/doc/cmd.rst
index 31ae6e01..63aa6ac5 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -364,7 +364,8 @@ command line::
TOTAL 76 10 87%
The ``--skip-covered`` switch will skip any file with 100% coverage, letting
-you focus on the files that still need attention. The ``--skip-empty`` switch
+you focus on the files that still need attention. The ``--no-skip-covered``
+option can be used if needed to see all the files. The ``--skip-empty`` switch
will skip any file with no executable statements.
If you have :ref:`recorded contexts <contexts>`, the ``--contexts`` option lets
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 2406d93d..e84f6dac 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -382,6 +382,16 @@ class CmdLineTest(BaseCmdLineTest):
cov.load()
cov.report(skip_covered=True)
""")
+ self.cmd_executes("report --skip-covered --no-skip-covered", """\
+ cov = Coverage()
+ cov.load()
+ cov.report(skip_covered=False)
+ """)
+ self.cmd_executes("report --no-skip-covered", """\
+ cov = Coverage()
+ cov.load()
+ cov.report(skip_covered=False)
+ """)
self.cmd_executes("report --skip-empty", """\
cov = Coverage()
cov.load()
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 7c70d7ff..ab6414af 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -300,36 +300,6 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
self.assertEqual(squeezed[6], "1 file skipped due to complete coverage.")
self.assertEqual(self.last_command_status, 0)
- def test_report_no_skip_covered(self):
- self.make_file("main.py", """
- import not_covered
-
- def normal():
- print("z")
- normal()
- """)
- self.make_file("not_covered.py", """
- def not_covered():
- print("n")
- """)
- self.omit_site_packages()
- out = self.run_command("coverage run main.py")
- self.assertEqual(out, "z\n")
- report = self.report_from_command("coverage report --skip-covered --no-skip-covered")
-
- # Name Stmts Miss Cover
- # ------------------------------------
- # main.py 4 0 100%
- # not_covered.py 2 1 50%
- # ------------------------------------
- # TOTAL 6 1 83%
-
- self.assertEqual(self.line_count(report), 6, report)
- squeezed = self.squeezed_lines(report)
- self.assertEqual(squeezed[2], "main.py 4 0 100%")
- self.assertEqual(squeezed[3], "not_covered.py 2 1 50%")
- self.assertEqual(squeezed[5], "TOTAL 6 1 83%")
-
def test_report_skip_covered_branches(self):
self.make_file("main.py", """
import not_covered, covered