Skip to content

Commit 9839ed9

Browse files
Fix linter issues
1 parent ce5e02f commit 9839ed9

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
@@ -67,7 +67,7 @@ def test_named_config_file(self, file_class: FilePathType) -> None:
6767
assert cov.config.data_file == "delete.me"
6868

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

100100
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
101-
def test_toml_ints_can_be_floats(self, filename) -> None:
101+
def test_toml_ints_can_be_floats(self, filename: str) -> None:
102102
# Test that our class doesn't reject integers when loading floats
103103
self.make_file(filename, """\
104104
# This is just a bogus toml file for testing.
@@ -209,7 +209,7 @@ def test_parse_errors(self, bad_config: str, msg: str) -> None:
209209
self.make_file(".coveragerc", bad_config)
210210
with pytest.raises(ConfigError, match=msg):
211211
coverage.Coverage()
212-
212+
213213
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
214214
@pytest.mark.parametrize("bad_config, msg", [
215215
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
@@ -228,7 +228,7 @@ def test_parse_errors(self, bad_config: str, msg: str) -> None:
228228
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
229229
('[tool.coverage.report]\nfail_under="s"', "couldn't convert to a float"),
230230
])
231-
def test_toml_parse_errors(self, filename, bad_config: str, msg: str) -> None:
231+
def test_toml_parse_errors(self, filename: str, bad_config: str, msg: str) -> None:
232232
# Im-parsable values raise ConfigError, with details.
233233
self.make_file(filename, bad_config)
234234
with pytest.raises(ConfigError, match=msg):
@@ -257,7 +257,7 @@ def test_environment_vars_in_config(self) -> None:
257257
assert cov.config.exclude_list == ["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
258258

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

334334
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
335-
def test_tilde_in_toml_config(self, filename) -> None:
335+
def test_tilde_in_toml_config(self, filename: str) -> None:
336336
# Config entries that are file paths can be tilde-expanded.
337337
self.make_file(filename, """\
338338
[tool.coverage.run]
@@ -448,9 +448,9 @@ def test_unknown_option(self) -> None:
448448
msg = r"Unrecognized option '\[run\] xyzzy=' in config file .coveragerc"
449449
with pytest.warns(CoverageWarning, match=msg):
450450
_ = coverage.Coverage()
451-
451+
452452
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
453-
def test_unknown_option_toml(self, filename) -> None:
453+
def test_unknown_option_toml(self, filename: str) -> None:
454454
self.make_file(filename, """\
455455
[tool.coverage.run]
456456
xyzzy = 17
@@ -467,7 +467,7 @@ def test_unknown_option_in_other_ini_file(self) -> None:
467467
msg = r"Unrecognized option '\[coverage:run\] huh=' in config file setup.cfg"
468468
with pytest.warns(CoverageWarning, match=msg):
469469
_ = coverage.Coverage()
470-
470+
471471
def test_exceptions_from_missing_things(self) -> None:
472472
self.make_file("config.ini", """\
473473
[run]
@@ -480,9 +480,9 @@ def test_exceptions_from_missing_things(self) -> None:
480480
with pytest.raises(ConfigError, match="No option 'foo' in section: 'xyzzy'"):
481481
config.get("xyzzy", "foo")
482482

483-
483+
484484
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
485-
def test_exclude_also(self, filename) -> None:
485+
def test_exclude_also(self, filename: str) -> None:
486486
self.make_file(filename, """\
487487
[tool.coverage.report]
488488
exclude_also = ["foobar", "raise .*Error"]
@@ -838,9 +838,9 @@ def test_no_toml_installed_pyproject_no_coverage(self) -> None:
838838
assert not cov.config.timid
839839
assert not cov.config.branch
840840
assert cov.config.data_file == ".coverage"
841-
841+
842842
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
843-
def test_exceptions_from_missing_toml_things(self, filename) -> None:
843+
def test_exceptions_from_missing_toml_things(self, filename: str) -> None:
844844
self.make_file(filename, """\
845845
[tool.coverage.run]
846846
branch = true
@@ -853,7 +853,7 @@ def test_exceptions_from_missing_toml_things(self, filename) -> None:
853853
config.get("xyzzy", "foo")
854854
with pytest.raises(ConfigError, match="No option 'foo' in section: 'tool.coverage.run'"):
855855
config.get("run", "foo")
856-
856+
857857
def test_coveragerc_toml_priority(self) -> None:
858858
"""Test that .coveragerc.toml has priority over pyproject.toml."""
859859
self.make_file(".coveragerc.toml", """\
@@ -862,20 +862,20 @@ def test_coveragerc_toml_priority(self) -> None:
862862
data_file = ".toml-data.dat"
863863
branch = true
864864
""")
865-
865+
866866
self.make_file("pyproject.toml", """\
867867
[tool.coverage.run]
868868
timid = false
869869
data_file = "pyproject-data.dat"
870870
branch = false
871871
""")
872872
cov = coverage.Coverage()
873-
873+
874874
assert cov.config.timid is True
875875
assert cov.config.data_file == ".toml-data.dat"
876876
assert cov.config.branch is True
877-
878-
877+
878+
879879
@pytest.mark.skipif(env.PYVERSION >= (3, 11), reason="Python 3.11 has toml in stdlib")
880880
def test_toml_file_exists_but_no_toml_support(self) -> None:
881881
"""Test behavior when .coveragerc.toml exists but TOML support is missing."""
@@ -884,7 +884,7 @@ def test_toml_file_exists_but_no_toml_support(self) -> None:
884884
timid = true
885885
data_file = ".toml-data.dat"
886886
""")
887-
887+
888888
with mock.patch.object(coverage.tomlconfig, "has_tomllib", False):
889889
msg = "Can't read '.coveragerc.toml' without TOML support"
890890
with pytest.raises(ConfigError, match=msg):
@@ -894,7 +894,7 @@ def test_toml_file_exists_but_no_toml_support(self) -> None:
894894
timid = false
895895
data_file = .ini-data.dat
896896
""")
897-
897+
898898
cov = coverage.Coverage()
899899
assert not cov.config.timid
900900
assert cov.config.data_file == ".ini-data.dat"

0 commit comments

Comments
 (0)