@@ -180,6 +180,8 @@ def run_coverage(
180
180
def assert_htmlcov_files_exist (self ) -> None :
181
181
"""Assert that all the expected htmlcov files exist."""
182
182
self .assert_exists ("htmlcov/index.html" )
183
+ self .assert_exists ("htmlcov/function_index.html" )
184
+ self .assert_exists ("htmlcov/class_index.html" )
183
185
self .assert_exists ("htmlcov/main_file_py.html" )
184
186
self .assert_exists ("htmlcov/helper1_py.html" )
185
187
self .assert_exists ("htmlcov/helper2_py.html" )
@@ -617,6 +619,26 @@ def normal():
617
619
res = self .run_coverage (covargs = dict (source = "." ), htmlargs = dict (skip_covered = True ))
618
620
assert res == 100.0
619
621
self .assert_doesnt_exist ("htmlcov/main_file_py.html" )
622
+ # Since there are no files to report, we can't collect any region
623
+ # information, so there are no region-based index pages.
624
+ self .assert_doesnt_exist ("htmlcov/function_index.html" )
625
+ self .assert_doesnt_exist ("htmlcov/class_index.html" )
626
+
627
+ def test_report_skip_covered_100_functions (self ) -> None :
628
+ self .make_file ("main_file.py" , """\
629
+ def normal():
630
+ print("z")
631
+ def abnormal():
632
+ print("a")
633
+ normal()
634
+ """ )
635
+ res = self .run_coverage (covargs = dict (source = "." ), htmlargs = dict (skip_covered = True ))
636
+ assert res == 80.0
637
+ self .assert_exists ("htmlcov/main_file_py.html" )
638
+ # We have a file to report, so we get function and class index pages,
639
+ # even though there are no classes.
640
+ self .assert_exists ("htmlcov/function_index.html" )
641
+ self .assert_exists ("htmlcov/class_index.html" )
620
642
621
643
def make_init_and_main (self ) -> None :
622
644
"""Helper to create files for skip_empty scenarios."""
0 commit comments