@@ -774,39 +774,35 @@ def test_no_toml_installed_explicit_toml(self) -> None:
774774                coverage .Coverage (config_file = "cov.toml" )
775775
776776    @pytest .mark .skipif (env .PYVERSION  >=  (3 , 11 ), reason = "Python 3.11 has toml in stdlib" ) 
777-     @pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ]) 
778-     def  test_no_toml_installed_pyproject_toml (self , filename ) ->  None :
779-         # Can't have coverage config in pyproject.toml and .coveragerc.toml without toml installed. 
780-         self .make_file (filename , """\  
777+     def  test_no_toml_installed_pyproject_toml (self ) ->  None :
778+         # Can't have coverage config in pyproject.toml without toml installed. 
779+         self .make_file ("pyproject.toml" , """\  
781780             # A toml file!
782781            [tool.coverage.run] 
783782            xyzzy = 17 
784783            """ )
785784        with  mock .patch .object (coverage .tomlconfig , "has_tomllib" , False ):
786-             msg  =  f "Can't read '{ filename }  ' without TOML support"
785+             msg  =  "Can't read 'pyproject.toml ' without TOML support" 
787786            with  pytest .raises (ConfigError , match = msg ):
788787                coverage .Coverage ()
789788
790789    @pytest .mark .skipif (env .PYVERSION  >=  (3 , 11 ), reason = "Python 3.11 has toml in stdlib" ) 
791-     @pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ]) 
792-     def  test_no_toml_installed_pyproject_toml_shorter_syntax (self , filename ) ->  None :
790+     def  test_no_toml_installed_pyproject_toml_shorter_syntax (self ) ->  None :
793791        # Can't have coverage config in pyproject.toml without toml installed. 
794-         self .make_file (filename , """\  
792+         self .make_file ("pyproject.toml" , """\  
795793             # A toml file!
796794            [tool.coverage] 
797795            run.parallel = true 
798796            """ )
799797        with  mock .patch .object (coverage .tomlconfig , "has_tomllib" , False ):
800-             msg  =  f "Can't read '{ filename }  ' without TOML support"
798+             msg  =  "Can't read 'pyproject.toml ' without TOML support" 
801799            with  pytest .raises (ConfigError , match = msg ):
802800                coverage .Coverage ()
803801
804- 
805802    @pytest .mark .skipif (env .PYVERSION  >=  (3 , 11 ), reason = "Python 3.11 has toml in stdlib" ) 
806-     @pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ]) 
807-     def  test_no_toml_installed_pyproject_no_coverage (self , filename ) ->  None :
803+     def  test_no_toml_installed_pyproject_no_coverage (self ) ->  None :
808804        # It's ok to have non-coverage pyproject.toml without toml installed. 
809-         self .make_file (filename , """\  
805+         self .make_file ("pyproject.toml" , """\  
810806             # A toml file!
811807            [tool.something] 
812808            xyzzy = 17 
@@ -853,3 +849,27 @@ def test_coveragerc_toml_priority(self) -> None:
853849        assert  cov .config .timid  is  True 
854850        assert  cov .config .data_file  ==  ".toml-data.dat" 
855851        assert  cov .config .branch  is  True 
852+         
853+     
854+     @pytest .mark .skipif (env .PYVERSION  >=  (3 , 11 ), reason = "Python 3.11 has toml in stdlib" ) 
855+     def  test_toml_file_exists_but_no_toml_support (self ) ->  None :
856+         """Test behavior when .coveragerc.toml exists but TOML support is missing.""" 
857+         self .make_file (".coveragerc.toml" , """\  
858+          [tool.coverage.run]
859+         timid = true 
860+         data_file = ".toml-data.dat" 
861+         """ )
862+     
863+         with  mock .patch .object (coverage .tomlconfig , "has_tomllib" , False ):
864+             msg  =  "Can't read '.coveragerc.toml' without TOML support" 
865+             with  pytest .raises (ConfigError , match = msg ):
866+                 coverage .Coverage (config_file = ".coveragerc.toml" )
867+             self .make_file (".coveragerc" , """\  
868+                  [run]
869+                 timid = false 
870+                 data_file = .ini-data.dat 
871+                 """ )
872+         
873+             cov  =  coverage .Coverage ()
874+             assert  not  cov .config .timid 
875+             assert  cov .config .data_file  ==  ".ini-data.dat" 
0 commit comments