summaryrefslogtreecommitdiff
path: root/tests
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
commit8ceb28bbfa180e44e1737e21f55254589979b6d9 (patch)
tree6f9b22da79346ba322147158d1c4d7a9c153eacc /tests
parent4c4b175dedd8b45200b577947b3dd56bfdfb8822 (diff)
downloadpython-coveragepy-8ceb28bbfa180e44e1737e21f55254589979b6d9.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')
-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 e67e4f5..1b2a51e 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")