@@ -281,7 +281,7 @@ def test_case_1():
281281 module_ast ,
282282 target_file ,
283283 format_with_black = config .configuration .test_case_output .format_with_black ,
284- coverage_by_import_only = coverage_by_import_only ,
284+ module_name_with_coverage = module_name if coverage_by_import_only else None ,
285285 )
286286 assert target_file .exists ()
287287 content = target_file .read_text (encoding = "utf-8" )
@@ -347,7 +347,7 @@ def _import_execute_export(
347347 module_ast ,
348348 export_path ,
349349 format_with_black = config .configuration .test_case_output .format_with_black ,
350- coverage_by_import_only = coverage_by_import_only ,
350+ module_name_with_coverage = module_name if coverage_by_import_only else None ,
351351 )
352352
353353 exported = export_path .read_text (encoding = "utf-8" )
@@ -532,8 +532,8 @@ def test_import_export_no_xfail(
532532
533533def test_coverage_by_import_only (tmp_path : Path ) -> None :
534534 """When no test cases exist, SUT is imported with coverage comment and an empty test."""
535- sut_module_name = "tests.fixtures.accessibles.accessible"
536- visitor = export .PyTestChromosomeToAstVisitor (sut_module_name = sut_module_name )
535+ module_name = "tests.fixtures.accessibles.accessible"
536+ visitor = export .PyTestChromosomeToAstVisitor (sut_module_name = module_name )
537537
538538 module_ast , coverage_by_import_only = visitor .to_module ()
539539
@@ -544,13 +544,12 @@ def test_coverage_by_import_only(tmp_path: Path) -> None:
544544 module_ast ,
545545 target_file ,
546546 format_with_black = False ,
547- coverage_by_import_only = coverage_by_import_only ,
547+ module_name_with_coverage = module_name if coverage_by_import_only else None ,
548548 )
549549
550550 content = target_file .read_text (encoding = "utf-8" )
551551
552552 assert "# Importing this module achieves coverage." in content
553- assert "# noqa: F401" in content
554- assert "import tests.fixtures.accessibles.accessible" in content
553+ assert "import tests.fixtures.accessibles.accessible # noqa: F401" in content
555554 assert "def test_empty():" in content
556555 assert " pass" in content
0 commit comments