Skip to content

Commit 4018790

Browse files
Fix linter issues
1 parent 578ee6c commit 4018790

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

tests/test_config.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_named_config_file(self, file_class: FilePathType) -> None:
6565
assert cov.config.data_file == "delete.me"
6666

6767
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
68-
def test_toml_config_file(self, filename) -> None:
68+
def test_toml_config_file(self, filename: str) -> None:
6969
# A pyproject.toml and coveragerc.toml will be read into the configuration.
7070
self.make_file(filename, """\
7171
# This is just a bogus toml file for testing.
@@ -96,7 +96,7 @@ def test_toml_config_file(self, filename) -> None:
9696
assert cov.config.get_plugin_options("plugins.a_plugin") == {"hello": "world"}
9797

9898
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
99-
def test_toml_ints_can_be_floats(self, filename) -> None:
99+
def test_toml_ints_can_be_floats(self, filename: str) -> None:
100100
# Test that our class doesn't reject integers when loading floats
101101
self.make_file(filename, """\
102102
# This is just a bogus toml file for testing.
@@ -207,7 +207,7 @@ def test_parse_errors(self, bad_config: str, msg: str) -> None:
207207
self.make_file(".coveragerc", bad_config)
208208
with pytest.raises(ConfigError, match=msg):
209209
coverage.Coverage()
210-
210+
211211
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
212212
@pytest.mark.parametrize("bad_config, msg", [
213213
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
@@ -226,7 +226,7 @@ def test_parse_errors(self, bad_config: str, msg: str) -> None:
226226
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
227227
('[tool.coverage.report]\nfail_under="s"', "couldn't convert to a float"),
228228
])
229-
def test_toml_parse_errors(self, filename, bad_config: str, msg: str) -> None:
229+
def test_toml_parse_errors(self, filename: str, bad_config: str, msg: str) -> None:
230230
# Im-parsable values raise ConfigError, with details.
231231
self.make_file(filename, bad_config)
232232
with pytest.raises(ConfigError, match=msg):
@@ -255,7 +255,7 @@ def test_environment_vars_in_config(self) -> None:
255255
assert cov.config.exclude_list == ["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
256256

257257
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
258-
def test_environment_vars_in_toml_config(self, filename) -> None:
258+
def test_environment_vars_in_toml_config(self, filename: str) -> None:
259259
# Config files can have $envvars in them.
260260
self.make_file(filename, """\
261261
[tool.coverage.run]
@@ -330,7 +330,7 @@ def expanduser(s: str) -> str:
330330
assert cov.config.paths == {'mapping': ['/Users/me/src', '/Users/joe/source']}
331331

332332
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
333-
def test_tilde_in_toml_config(self, filename) -> None:
333+
def test_tilde_in_toml_config(self, filename: str) -> None:
334334
# Config entries that are file paths can be tilde-expanded.
335335
self.make_file(filename, """\
336336
[tool.coverage.run]
@@ -446,9 +446,9 @@ def test_unknown_option(self) -> None:
446446
msg = r"Unrecognized option '\[run\] xyzzy=' in config file .coveragerc"
447447
with pytest.warns(CoverageWarning, match=msg):
448448
_ = coverage.Coverage()
449-
449+
450450
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
451-
def test_unknown_option_toml(self, filename) -> None:
451+
def test_unknown_option_toml(self, filename: str) -> None:
452452
self.make_file(filename, """\
453453
[tool.coverage.run]
454454
xyzzy = 17
@@ -465,7 +465,7 @@ def test_unknown_option_in_other_ini_file(self) -> None:
465465
msg = r"Unrecognized option '\[coverage:run\] huh=' in config file setup.cfg"
466466
with pytest.warns(CoverageWarning, match=msg):
467467
_ = coverage.Coverage()
468-
468+
469469
def test_exceptions_from_missing_things(self) -> None:
470470
self.make_file("config.ini", """\
471471
[run]
@@ -478,9 +478,9 @@ def test_exceptions_from_missing_things(self) -> None:
478478
with pytest.raises(ConfigError, match="No option 'foo' in section: 'xyzzy'"):
479479
config.get("xyzzy", "foo")
480480

481-
481+
482482
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
483-
def test_exclude_also(self, filename) -> None:
483+
def test_exclude_also(self, filename: str) -> None:
484484
self.make_file(filename, """\
485485
[tool.coverage.report]
486486
exclude_also = ["foobar", "raise .*Error"]
@@ -813,9 +813,9 @@ def test_no_toml_installed_pyproject_no_coverage(self) -> None:
813813
assert not cov.config.timid
814814
assert not cov.config.branch
815815
assert cov.config.data_file == ".coverage"
816-
816+
817817
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
818-
def test_exceptions_from_missing_toml_things(self, filename) -> None:
818+
def test_exceptions_from_missing_toml_things(self, filename: str) -> None:
819819
self.make_file(filename, """\
820820
[tool.coverage.run]
821821
branch = true
@@ -828,7 +828,7 @@ def test_exceptions_from_missing_toml_things(self, filename) -> None:
828828
config.get("xyzzy", "foo")
829829
with pytest.raises(ConfigError, match="No option 'foo' in section: 'tool.coverage.run'"):
830830
config.get("run", "foo")
831-
831+
832832
def test_coveragerc_toml_priority(self) -> None:
833833
"""Test that .coveragerc.toml has priority over pyproject.toml."""
834834
self.make_file(".coveragerc.toml", """\
@@ -837,20 +837,20 @@ def test_coveragerc_toml_priority(self) -> None:
837837
data_file = ".toml-data.dat"
838838
branch = true
839839
""")
840-
840+
841841
self.make_file("pyproject.toml", """\
842842
[tool.coverage.run]
843843
timid = false
844844
data_file = "pyproject-data.dat"
845845
branch = false
846846
""")
847847
cov = coverage.Coverage()
848-
848+
849849
assert cov.config.timid is True
850850
assert cov.config.data_file == ".toml-data.dat"
851851
assert cov.config.branch is True
852-
853-
852+
853+
854854
@pytest.mark.skipif(env.PYVERSION >= (3, 11), reason="Python 3.11 has toml in stdlib")
855855
def test_toml_file_exists_but_no_toml_support(self) -> None:
856856
"""Test behavior when .coveragerc.toml exists but TOML support is missing."""
@@ -859,7 +859,7 @@ def test_toml_file_exists_but_no_toml_support(self) -> None:
859859
timid = true
860860
data_file = ".toml-data.dat"
861861
""")
862-
862+
863863
with mock.patch.object(coverage.tomlconfig, "has_tomllib", False):
864864
msg = "Can't read '.coveragerc.toml' without TOML support"
865865
with pytest.raises(ConfigError, match=msg):
@@ -869,7 +869,7 @@ def test_toml_file_exists_but_no_toml_support(self) -> None:
869869
timid = false
870870
data_file = .ini-data.dat
871871
""")
872-
872+
873873
cov = coverage.Coverage()
874874
assert not cov.config.timid
875875
assert cov.config.data_file == ".ini-data.dat"

0 commit comments

Comments
 (0)