@@ -68,7 +68,7 @@ def test_named_config_file(self, file_class: FilePathType) -> None:
68
68
assert cov .config .data_file == "delete.me"
69
69
70
70
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
71
- def test_toml_config_file (self , filename ) -> None :
71
+ def test_toml_config_file (self , filename : str ) -> None :
72
72
# A pyproject.toml and coveragerc.toml will be read into the configuration.
73
73
self .make_file (filename , """\
74
74
# This is just a bogus toml file for testing.
@@ -100,7 +100,7 @@ def test_toml_config_file(self, filename) -> None:
100
100
"hello" : "world" }
101
101
102
102
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
103
- def test_toml_ints_can_be_floats (self , filename ) -> None :
103
+ def test_toml_ints_can_be_floats (self , filename : str ) -> None :
104
104
# Test that our class doesn't reject integers when loading floats
105
105
self .make_file (filename , """\
106
106
# This is just a bogus toml file for testing.
@@ -242,7 +242,7 @@ def test_parse_errors(self, bad_config: str, msg: str) -> None:
242
242
("[tool.coverage.report]\n precision=1.23" , "not an integer" ),
243
243
('[tool.coverage.report]\n fail_under="s"' , "couldn't convert to a float" ),
244
244
])
245
- def test_toml_parse_errors (self , filename , bad_config : str , msg : str ) -> None :
245
+ def test_toml_parse_errors (self , filename : str , bad_config : str , msg : str ) -> None :
246
246
# Im-parsable values raise ConfigError, with details.
247
247
self .make_file (filename , bad_config )
248
248
with pytest .raises (ConfigError , match = msg ):
@@ -272,7 +272,7 @@ def test_environment_vars_in_config(self) -> None:
272
272
"the_$one" , "anotherZZZ" , "xZZZy" , "xy" , "huh${X}what" ]
273
273
274
274
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
275
- def test_environment_vars_in_toml_config (self , filename ) -> None :
275
+ def test_environment_vars_in_toml_config (self , filename : str ) -> None :
276
276
# Config files can have $envvars in them.
277
277
self .make_file (filename , """\
278
278
[tool.coverage.run]
@@ -339,7 +339,7 @@ def test_tilde_in_config(self) -> None:
339
339
self .assert_tilde_results ()
340
340
341
341
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
342
- def test_tilde_in_toml_config (self , filename ) -> None :
342
+ def test_tilde_in_toml_config (self , filename : str ) -> None :
343
343
# Config entries that are file paths can be tilde-expanded.
344
344
self .make_file (filename , """\
345
345
[tool.coverage.run]
@@ -472,7 +472,7 @@ def test_unknown_option(self) -> None:
472
472
_ = coverage .Coverage ()
473
473
474
474
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
475
- def test_unknown_option_toml (self , filename ) -> None :
475
+ def test_unknown_option_toml (self , filename : str ) -> None :
476
476
self .make_file (filename , """\
477
477
[tool.coverage.run]
478
478
xyzzy = 17
@@ -525,7 +525,7 @@ def test_exceptions_from_missing_things(self) -> None:
525
525
config .get ("xyzzy" , "foo" )
526
526
527
527
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
528
- def test_exclude_also (self , filename ) -> None :
528
+ def test_exclude_also (self , filename : str ) -> None :
529
529
self .make_file (filename , """\
530
530
[tool.coverage.report]
531
531
exclude_also = ["foobar", "raise .*Error"]
@@ -900,7 +900,7 @@ def test_no_toml_installed_pyproject_no_coverage(self) -> None:
900
900
assert cov .config .data_file == ".coverage"
901
901
902
902
@pytest .mark .parametrize ("filename" , ["pyproject.toml" , ".coveragerc.toml" ])
903
- def test_exceptions_from_missing_toml_things (self , filename ) -> None :
903
+ def test_exceptions_from_missing_toml_things (self , filename : str ) -> None :
904
904
self .make_file (filename , """\
905
905
[tool.coverage.run]
906
906
branch = true
@@ -934,8 +934,7 @@ def test_coveragerc_toml_priority(self) -> None:
934
934
assert cov .config .timid is True
935
935
assert cov .config .data_file == ".toml-data.dat"
936
936
assert cov .config .branch is True
937
-
938
-
937
+
939
938
@pytest .mark .skipif (env .PYVERSION >= (3 , 11 ), reason = "Python 3.11 has toml in stdlib" )
940
939
def test_toml_file_exists_but_no_toml_support (self ) -> None :
941
940
"""Test behavior when .coveragerc.toml exists but TOML support is missing."""
@@ -944,7 +943,7 @@ def test_toml_file_exists_but_no_toml_support(self) -> None:
944
943
timid = true
945
944
data_file = ".toml-data.dat"
946
945
""" )
947
-
946
+
948
947
with mock .patch .object (coverage .tomlconfig , "has_tomllib" , False ):
949
948
msg = "Can't read '.coveragerc.toml' without TOML support"
950
949
with pytest .raises (ConfigError , match = msg ):
@@ -954,7 +953,7 @@ def test_toml_file_exists_but_no_toml_support(self) -> None:
954
953
timid = false
955
954
data_file = .ini-data.dat
956
955
""" )
957
-
956
+
958
957
cov = coverage .Coverage ()
959
958
assert not cov .config .timid
960
959
assert cov .config .data_file == ".ini-data.dat"
0 commit comments