@@ -736,20 +736,21 @@ def test_accenteddotpy_not_python(self) -> None:
736736 with pytest .raises (NotPython , match = msg ):
737737 self .get_report (cov , morfs = ["accented\xe2 .py" ])
738738
739- def test_dotpy_not_python_ignored (self ) -> None :
740- # We run a .py file, and when reporting, we can't parse it as Python,
739+ @pytest .mark .parametrize ("filename" , ["mycode.py" , "my_script" ])
740+ def test_dotpy_not_python_ignored (self , filename : str ) -> None :
741+ # We run a Python file, and when reporting, we can't parse it as Python,
741742 # but we've said to ignore errors, so there's no error reported,
742743 # though we still get a warning.
743- self .make_file ("mycode.py" , "This isn't python at all!" )
744- self .make_data_file (lines = {"mycode.py" : [1 ]})
744+ self .make_file (filename , "This isn't python at all! I can't cope. " )
745+ self .make_data_file (lines = {filename : [1 ]})
745746 cov = coverage .Coverage ()
746747 cov .load ()
747748 with pytest .raises (NoDataError , match = "No data to report." ):
748749 with pytest .warns (Warning ) as warns :
749- self .get_report (cov , morfs = ["mycode.py" ], ignore_errors = True )
750+ self .get_report (cov , morfs = [filename ], ignore_errors = True )
750751 assert_coverage_warnings (
751752 warns ,
752- re .compile (r "Couldn't parse Python file '.*[/\\]mycode.py ' \(couldnt-parse\)" ),
753+ re .compile (rf "Couldn't parse Python file '.*[/\\]{ filename } ' \(couldnt-parse\)" ),
753754 )
754755
755756 def test_dothtml_not_python (self ) -> None :
0 commit comments