From eaa3c8adf13d3cfa0e83a6230b445a6ac54109de Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Mar 2023 08:51:02 -0400 Subject: test: check the HTML for context output --- tests/gold/html/contexts/index.html | 102 +++++++++++++++++++++++++ tests/gold/html/contexts/two_tests_py.html | 119 +++++++++++++++++++++++++++++ tests/test_html.py | 3 + 3 files changed, 224 insertions(+) create mode 100644 tests/gold/html/contexts/index.html create mode 100644 tests/gold/html/contexts/two_tests_py.html (limited to 'tests') diff --git a/tests/gold/html/contexts/index.html b/tests/gold/html/contexts/index.html new file mode 100644 index 00000000..05d6a457 --- /dev/null +++ b/tests/gold/html/contexts/index.html @@ -0,0 +1,102 @@ + + + + + Coverage report + + + + + +
+
+

Coverage report: + 94% +

+ +
+ +
+

+ coverage.py v7.2.3a0.dev1, + created at 2023-03-21 08:44 -0400 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Modulestatementsmissingexcludedcoverage
two_tests.py171094%
Total171094%
+

+ No items found using the specified filter. +

+
+ + + diff --git a/tests/gold/html/contexts/two_tests_py.html b/tests/gold/html/contexts/two_tests_py.html new file mode 100644 index 00000000..5e107b5e --- /dev/null +++ b/tests/gold/html/contexts/two_tests_py.html @@ -0,0 +1,119 @@ + + + + + Coverage for two_tests.py: 94% + + + + + +
+ +
+
+

1def helper(lineno): 

+

2 x = 2 (empty)two_tests.test_onetwo_tests.test_two

+

3 

+

4def test_one(): 

+

5 a = 5 two_tests.test_one

+

6 helper(6) two_tests.test_one

+

7 

+

8def test_two(): 

+

9 a = 9 two_tests.test_two

+

10 b = 10 two_tests.test_two

+

11 if a > 11: two_tests.test_two

+

12 b = 12 

+

13 assert a == (13-4) two_tests.test_two

+

14 assert b == (14-4) two_tests.test_two

+

15 helper( two_tests.test_two

+

16 16 

+

17 ) 

+

18 

+

19test_one() 

+

20x = 20 

+

21helper(21) 

+

22test_two() 

+
+ + + diff --git a/tests/test_html.py b/tests/test_html.py index 5113cd06..89ad8d1c 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -1199,6 +1199,9 @@ class HtmlWithContextsTest(HtmlTestHelpers, CoverageTest): ] assert sorted(expected) == sorted(actual) + cov.html_report(mod, directory="out/contexts") + compare_html(gold_path("html/contexts"), "out/contexts") + def test_filtered_dynamic_contexts(self) -> None: self.make_file("two_tests.py", self.SOURCE) cov = coverage.Coverage(source=["."]) -- cgit v1.2.1