summaryrefslogtreecommitdiff
path: root/tests/test_html.py
diff options
context:
space:
mode:
authorMatthew Boehm <boehm.matthew@gmail.com>2016-06-02 19:13:30 -0400
committerMatthew Boehm <boehm.matthew@gmail.com>2016-06-02 19:13:30 -0400
commit5f169673e183ea4de975d7073c62933bb700e055 (patch)
treed0f4b1871e6ccdf3210d8a1b5802add2bfefa65d /tests/test_html.py
parent8bce4538ba831aed7a891f8282b8faabdd78bfa2 (diff)
downloadpython-coveragepy-git-5f169673e183ea4de975d7073c62933bb700e055.tar.gz
Emit a warning when an invalid file is detected with ignore_errors=true.
Previously, when an invalid file was encountered, it would be silently ignored.
Diffstat (limited to 'tests/test_html.py')
-rw-r--r--tests/test_html.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_html.py b/tests/test_html.py
index e67e4f5b..1b2a51e9 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -274,6 +274,20 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest):
self.start_import_stop(cov, "innocuous")
self.make_file("innocuous.py", "<h1>This isn't python!</h1>")
cov.html_report(ignore_errors=True)
+ self.assertEqual(
+ len(cov._warnings),
+ 1,
+ "Expected a warning to be thrown when an invalid python file is parsed")
+ self.assertIn(
+ "Could not parse python file",
+ cov._warnings[0],
+ "Warning message should be in 'invalid file' warning"
+ )
+ self.assertIn(
+ "innocuous.py",
+ cov._warnings[0],
+ "Filename should be in 'invalid file' warning"
+ )
self.assert_exists("htmlcov/index.html")
# This would be better as a glob, if the HTML layout changes:
self.assert_doesnt_exist("htmlcov/innocuous.html")