diff options
-rw-r--r-- | tests/farm/html/src/partial.ini | 9 | ||||
-rw-r--r-- | tests/farm/html/src/partial.py | 9 | ||||
-rw-r--r-- | tests/test_html.py | 4 |
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 00000000..cdb241b5 --- /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 66dddacd..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 d89d92c7..b1f813ed 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", |