summaryrefslogtreecommitdiff
path: root/tests/test_html.py
diff options
context:
space:
mode:
authorStephan Richter <stephan.richter@gmail.com>2019-01-26 15:15:07 -0500
committerNed Batchelder <ned@nedbatchelder.com>2019-06-10 17:15:32 -0400
commite1574b260db45ec00074c1d9aafc3586cb3952a0 (patch)
treed5d7843e6ab904ca1bec7284c63f91e29f548375 /tests/test_html.py
parent0ef160da9c07e1186f1f59f1490ff3160ffff97e (diff)
downloadpython-coveragepy-git-e1574b260db45ec00074c1d9aafc3586cb3952a0.tar.gz
Add some tests for new methods.
Diffstat (limited to 'tests/test_html.py')
-rw-r--r--tests/test_html.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_html.py b/tests/test_html.py
index 64546df1..c561f99d 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -90,6 +90,30 @@ class HtmlTestHelpers(CoverageTest):
)
+class HtmlWithContextsTest(HtmlTestHelpers, CoverageTest):
+ """Tests of the HTML reports with shown contexts."""
+
+ def setUp(self):
+ super(HtmlWithContextsTest, self).setUp()
+
+ # At least one of our tests monkey-patches the version of coverage.py,
+ # so grab it here to restore it later.
+ self.real_coverage_version = coverage.__version__
+ self.addCleanup(setattr, coverage, "__version__", self.real_coverage_version)
+
+ def test_html_created(self):
+ # Test basic HTML generation: files should be created.
+ self.create_initial_files()
+ self.run_coverage(htmlargs={'show_contexts': True})
+
+ self.assert_exists("htmlcov/index.html")
+ self.assert_exists("htmlcov/main_file_py.html")
+ self.assert_exists("htmlcov/helper1_py.html")
+ self.assert_exists("htmlcov/helper2_py.html")
+ self.assert_exists("htmlcov/style.css")
+ self.assert_exists("htmlcov/coverage_html.js")
+
+
class FileWriteTracker(object):
"""A fake object to track how `open` is used to write files."""
def __init__(self, written):