Skip to content

Commit 6bee75f

Browse files
Revert the formatting changes
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
1 parent 5f4e5b0 commit 6bee75f

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

doc/config.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ environment variable.
3939

4040
If ``.coveragerc`` doesn't exist and another file hasn't been specified, then
4141
coverage.py will look for settings in other common configuration files, in this
42-
order: .coveragerc.toml, setup.cfg, tox.ini, or pyproject.toml. The first file found with
42+
order: :file:`.coveragerc.toml`, setup.cfg, tox.ini, or pyproject.toml. The first file found with
4343
coverage.py settings will be used and other files won't be consulted.
4444

45-
Coverage.py will read from ".coveragerc.toml" and "pyproject.toml" if TOML support is available,
45+
Coverage.py will read from ".coveragerc.toml" or "pyproject.toml" if TOML support is available,
4646
either because you are running on Python 3.11 or later, or because you
4747
installed with the ``toml`` extra (``pip install coverage[toml]``). Both files
4848
use the same ``[tool.coverage]`` section structure.
@@ -137,7 +137,6 @@ Here's a sample configuration file, in each syntax:
137137
[html]
138138
directory = coverage_html_report
139139
""",
140-
141140
toml=r"""
142141
[tool.coverage.run]
143142
branch = true

tests/test_config.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def test_default_config(self) -> None:
3333

3434
def test_arguments(self) -> None:
3535
# Arguments to the constructor are applied to the configuration.
36-
cov = coverage.Coverage(
37-
timid=True, data_file="fooey.dat", concurrency="multiprocessing")
36+
cov = coverage.Coverage(timid=True, data_file="fooey.dat", concurrency="multiprocessing")
3837
assert cov.config.timid
3938
assert not cov.config.branch
4039
assert cov.config.data_file == "fooey.dat"
@@ -69,7 +68,7 @@ def test_named_config_file(self, file_class: FilePathType) -> None:
6968

7069
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
7170
def test_toml_config_file(self, filename: str) -> None:
72-
# A pyproject.toml and coveragerc.toml will be read into the configuration.
71+
# A pyproject.toml or coveragerc.toml will be read into the configuration.
7372
self.make_file(filename, """\
7473
# This is just a bogus toml file for testing.
7574
[tool.somethingelse]
@@ -268,8 +267,7 @@ def test_environment_vars_in_config(self) -> None:
268267
cov = coverage.Coverage()
269268
assert cov.config.data_file == "hello-world.fooey"
270269
assert cov.config.branch is True
271-
assert cov.config.exclude_list == [
272-
"the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
270+
assert cov.config.exclude_list == ["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
273271

274272
@pytest.mark.parametrize("filename", ["pyproject.toml", ".coveragerc.toml"])
275273
def test_environment_vars_in_toml_config(self, filename: str) -> None:
@@ -303,8 +301,7 @@ def test_environment_vars_in_toml_config(self, filename: str) -> None:
303301
assert cov.config.branch is True
304302
assert cov.config.precision == 3
305303
assert cov.config.data_file == "hello-world.fooey"
306-
assert cov.config.exclude_list == [
307-
"the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
304+
assert cov.config.exclude_list == ["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
308305

309306
def test_tilde_in_config(self) -> None:
310307
# Config entries that are file paths can be tilde-expanded.
@@ -393,8 +390,7 @@ def expanduser(s: str) -> str:
393390
assert cov.config.lcov_output == "/Users/me/lcov/~foo.lcov"
394391
assert cov.config.xml_output == "/Users/me/somewhere/xml.out"
395392
assert cov.config.exclude_list == ["~/data.file", "~joe/html_dir"]
396-
assert cov.config.paths == {'mapping': [
397-
'/Users/me/src', '/Users/joe/source']}
393+
assert cov.config.paths == {'mapping': ['/Users/me/src', '/Users/joe/source']}
398394

399395
def test_tweaks_after_constructor(self) -> None:
400396
# set_option can be used after construction to affect the config.
@@ -450,8 +446,7 @@ def test_tweak_error_checking(self) -> None:
450446
def test_tweak_plugin_options(self) -> None:
451447
# Plugin options have a more flexible syntax.
452448
cov = coverage.Coverage()
453-
cov.set_option("run:plugins", [
454-
"fooey.plugin", "xyzzy.coverage.plugin"])
449+
cov.set_option("run:plugins", ["fooey.plugin", "xyzzy.coverage.plugin"])
455450
cov.set_option("fooey.plugin:xyzzy", 17)
456451
cov.set_option("xyzzy.coverage.plugin:plugh", ["a", "b"])
457452
with pytest.raises(ConfigError, match="No such option: 'no_such.plugin:foo'"):
@@ -477,7 +472,7 @@ def test_unknown_option_toml(self, filename: str) -> None:
477472
[tool.coverage.run]
478473
xyzzy = 17
479474
""")
480-
msg = f"Unrecognized option '\\[tool.coverage.run\\] xyzzy=' in config file {filename}"
475+
msg = fr"Unrecognized option '\[tool.coverage.run\] xyzzy=' in config file {filename}"
481476
with pytest.warns(CoverageWarning, match=msg):
482477
_ = coverage.Coverage()
483478

@@ -543,8 +538,7 @@ def test_partial_also(self) -> None:
543538
""")
544539
cov = coverage.Coverage()
545540

546-
expected = coverage.config.DEFAULT_PARTIAL + \
547-
["foobar", "raise .*Error"]
541+
expected = coverage.config.DEFAULT_PARTIAL + ["foobar", "raise .*Error"]
548542
assert cov.config.partial_list == expected
549543

550544
def test_core_option(self) -> None:
@@ -736,8 +730,7 @@ def check_config_file_settings_in_other_file(self, fname: str, contents: str) ->
736730
self.assert_config_settings_are_correct(cov)
737731

738732
def test_config_file_settings_in_setupcfg(self) -> None:
739-
self.check_config_file_settings_in_other_file(
740-
"setup.cfg", self.SETUP_CFG)
733+
self.check_config_file_settings_in_other_file("setup.cfg", self.SETUP_CFG)
741734

742735
def test_config_file_settings_in_toxini(self) -> None:
743736
self.check_config_file_settings_in_other_file("tox.ini", self.TOX_INI)
@@ -750,12 +743,10 @@ def check_other_config_if_coveragerc_specified(self, fname: str, contents: str)
750743
self.assert_config_settings_are_correct(cov)
751744

752745
def test_config_file_settings_in_setupcfg_if_coveragerc_specified(self) -> None:
753-
self.check_other_config_if_coveragerc_specified(
754-
"setup.cfg", self.SETUP_CFG)
746+
self.check_other_config_if_coveragerc_specified("setup.cfg", self.SETUP_CFG)
755747

756748
def test_config_file_settings_in_tox_if_coveragerc_specified(self) -> None:
757-
self.check_other_config_if_coveragerc_specified(
758-
"tox.ini", self.TOX_INI)
749+
self.check_other_config_if_coveragerc_specified("tox.ini", self.TOX_INI)
759750

760751
def check_other_not_read_if_coveragerc(self, fname: str) -> None:
761752
"""Check config `fname` is not read if .coveragerc exists."""

0 commit comments

Comments
 (0)