@@ -736,20 +736,21 @@ def test_accenteddotpy_not_python(self) -> None:
736
736
with pytest .raises (NotPython , match = msg ):
737
737
self .get_report (cov , morfs = ["accented\xe2 .py" ])
738
738
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,
741
742
# but we've said to ignore errors, so there's no error reported,
742
743
# 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 ]})
745
746
cov = coverage .Coverage ()
746
747
cov .load ()
747
748
with pytest .raises (NoDataError , match = "No data to report." ):
748
749
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 )
750
751
assert_coverage_warnings (
751
752
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\)" ),
753
754
)
754
755
755
756
def test_dothtml_not_python (self ) -> None :
0 commit comments