summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorloic@dachary.org <loic@dachary.org>2016-12-19 01:19:54 +0100
committerloic@dachary.org <loic@dachary.org>2016-12-19 01:19:54 +0100
commit1b24e9a292281239135e7c6aeedaaeec7fe7d858 (patch)
tree7542a7451f65880c622ebcb41d1175c94f99220c
parentc863b83d505397c1af74c152f4f3900c80877073 (diff)
downloadpython-coveragepy-git-1b24e9a292281239135e7c6aeedaaeec7fe7d858.tar.gz
html report --skip-covered with branches #433
Add a test because the code path is significantly different. Also document --skip-covered with the coverage html command. close #433 --HG-- branch : issue-433-2
-rw-r--r--doc/cmd.rst2
-rw-r--r--tests/test_html.py18
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/cmd.rst b/doc/cmd.rst
index bbeff182..8b97ce37 100644
--- a/doc/cmd.rst
+++ b/doc/cmd.rst
@@ -366,6 +366,8 @@ is a data file that is used to speed up reporting the next time. If you
generate a new report into the same directory, coverage.py will skip
generating unchanged pages, making the process faster.
+The ``--skip-covered`` switch will leave out any file with 100% coverage,
+letting you focus on the files that still need attention.
.. _cmd_annotation:
diff --git a/tests/test_html.py b/tests/test_html.py
index b9813624..bf473015 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -465,6 +465,24 @@ class HtmlTest(HtmlTestHelpers, CoverageTest):
self.assert_doesnt_exist("htmlcov/main_py.html")
self.assert_exists("htmlcov/not_covered_py.html")
+ def test_report_skip_covered_branches(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.run_command("coverage run --branch main.py")
+ self.run_command("coverage html --skip-covered")
+ self.assert_exists("htmlcov/index.html")
+ self.assert_doesnt_exist("htmlcov/main_py.html")
+ self.assert_exists("htmlcov/not_covered_py.html")
+
class HtmlStaticFileTest(CoverageTest):
"""Tests of the static file copying for the HTML report."""