summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-30 06:22:54 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-11-30 06:22:54 -0500
commit741cd92f2ef3e70619a6a30cd592cd9f54053db2 (patch)
tree51592c630722a0273ff2e1e564e52f2a12edc3ac
parenta364b5313a20a622fd2b37a36072e98e843784de (diff)
downloadpython-coveragepy-741cd92f2ef3e70619a6a30cd592cd9f54053db2.tar.gz
Test excluded lines in the html report
-rw-r--r--tests/farm/html/src/partial.ini9
-rw-r--r--tests/farm/html/src/partial.py9
-rw-r--r--tests/test_html.py4
3 files changed, 18 insertions, 4 deletions
diff --git a/tests/farm/html/src/partial.ini b/tests/farm/html/src/partial.ini
new file mode 100644
index 0000000..cdb241b
--- /dev/null
+++ b/tests/farm/html/src/partial.ini
@@ -0,0 +1,9 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
+
+[run]
+branch = True
+
+[report]
+exclude_lines =
+ raise AssertionError
diff --git a/tests/farm/html/src/partial.py b/tests/farm/html/src/partial.py
index 66dddac..0f8fbe3c 100644
--- a/tests/farm/html/src/partial.py
+++ b/tests/farm/html/src/partial.py
@@ -1,9 +1,9 @@
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-# partial branches
+# partial branches and excluded lines
-a = 3
+a = 6
while True:
break
@@ -18,4 +18,7 @@ if 0:
never_happen()
if 1:
- a = 13
+ a = 21
+
+if a == 23:
+ raise AssertionError("Can't")
diff --git a/tests/test_html.py b/tests/test_html.py
index d89d92c..b1f813e 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -708,7 +708,7 @@ class HtmlGoldTests(CoverageGoldTest):
with change_dir("src"):
# pylint: disable=import-error
- cov = coverage.Coverage(branch=True)
+ cov = coverage.Coverage(config_file="partial.ini")
cov.start()
import partial # pragma: nested
cov.stop() # pragma: nested
@@ -722,6 +722,8 @@ class HtmlGoldTests(CoverageGoldTest):
'<p id="t14" class="stm run hide_run">',
# The "if 0" and "if 1" statements are optimized away.
'<p id="t17" class="pln">',
+ # The "raise AssertionError" is excluded by regex in the .ini.
+ '<p id="t24" class="exc">',
)
contains(
"out/partial/index.html",