diff options
Diffstat (limited to 'tests/test_html.py')
-rw-r--r-- | tests/test_html.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_html.py b/tests/test_html.py index 6c4c706c..b543fa08 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -1127,3 +1127,20 @@ class HtmlWithContextsTest(HtmlTestHelpers, CoverageTest): self.start_import_stop(cov, "two_tests") with self.assert_warnings(cov, ["No contexts were measured"]): cov.html_report() + + def test_dynamic_contexts_relative_files(self): + self.make_file("two_tests.py", self.SOURCE) + self.make_file("config", "[run]\nrelative_files = True") + cov = coverage.Coverage(source=["."], config_file="config") + cov.set_option("run:dynamic_context", "test_function") + cov.set_option("html:show_contexts", True) + mod = self.start_import_stop(cov, "two_tests") + d = self.html_data_from_cov(cov, mod) + context_labels = [self.EMPTY, 'two_tests.test_one', 'two_tests.test_two'] + expected_lines = [self.OUTER_LINES, self.TEST_ONE_LINES, self.TEST_TWO_LINES] + for label, expected in zip(context_labels, expected_lines): + actual = [ + ld.number for ld in d.lines + if label == ld.contexts_label or label in (ld.contexts or ()) + ] + assert sorted(expected) == sorted(actual) |