Skip to content

Commit 05be667

Browse files
Update the documentation and fix code formatting in tests/test_config.py
1 parent 97975fa commit 05be667

File tree

8 files changed

+29
-23
lines changed

8 files changed

+29
-23
lines changed

doc/cog_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def show_configs(ini, toml):
8989
print(".. tabs::\n")
9090
for name, syntax, text in [
9191
(".coveragerc", "ini", ini),
92-
("pyproject.toml", "toml", toml),
92+
(".coveragerc.toml or pyproject.toml", "toml", toml),
9393
("setup.cfg or tox.ini", "ini", ini2),
9494
]:
9595
print(f" .. code-tab:: {syntax}")

doc/config.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Here's a sample configuration file, in each syntax:
257257
[coverage:html]
258258
directory = coverage_html_report
259259

260-
.. [[[end]]] (sum: HU1Z62mvRK)
260+
.. [[[end]]] (sum: FvgoIIyfXR)
261261
262262
263263
The specific configuration settings are described below. Many sections and
@@ -616,7 +616,7 @@ equivalent when combining data from different machines:
616616
/jenkins/build/*/src
617617
c:\myproj\src
618618
619-
.. [[[end]]] (sum: oHSl8SGiMT)
619+
.. [[[end]]] (sum: bV+PjKu+HS)
620620
621621
622622
The names of the entries ("source" in this example) are ignored, you may choose

doc/contexts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The ``[run] dynamic_context`` setting has only one option now. Set it to
9797
dynamic_context = test_function
9898

9999
.. code-tab:: toml
100-
:caption: pyproject.toml
100+
:caption: .coveragerc.toml or pyproject.toml
101101

102102
[tool.coverage.run]
103103
dynamic_context = "test_function"
@@ -108,7 +108,7 @@ The ``[run] dynamic_context`` setting has only one option now. Set it to
108108
[coverage:run]
109109
dynamic_context = test_function
110110

111-
.. [[[end]]] (sum: dZTDYjHw71)
111+
.. [[[end]]] (sum: Hn9VZdxp00)
112112
113113
Each test function you run will be considered a separate dynamic context, and
114114
coverage data will be segregated for each. A test function is any function

doc/excluding.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ all of them by adding a regex to the exclusion list:
145145
def __repr__
146146

147147
.. code-tab:: toml
148-
:caption: pyproject.toml
148+
:caption: .coveragerc.toml or pyproject.toml
149149

150150
[tool.coverage.report]
151151
exclude_also = [
@@ -159,7 +159,7 @@ all of them by adding a regex to the exclusion list:
159159
exclude_also =
160160
def __repr__
161161

162-
.. [[[end]]] (sum: 8+cOvxKPvv)
162+
.. [[[end]]] (sum: QqurBI2O5i)
163163
164164
For example, here's a list of exclusions I've used:
165165

@@ -216,7 +216,7 @@ For example, here's a list of exclusions I've used:
216216
@(abc\.)?abstractmethod
217217

218218
.. code-tab:: toml
219-
:caption: pyproject.toml
219+
:caption: .coveragerc.toml or pyproject.toml
220220

221221
[tool.coverage.report]
222222
exclude_also = [
@@ -248,7 +248,7 @@ For example, here's a list of exclusions I've used:
248248
class .*\bProtocol\):
249249
@(abc\.)?abstractmethod
250250

251-
.. [[[end]]] (sum: ZQsgnt0nES)
251+
.. [[[end]]] (sum: z5MhXz2dFm)
252252
253253
The :ref:`config_report_exclude_also` option adds regexes to the built-in
254254
default list so that you can add your own exclusions. The older
@@ -319,7 +319,7 @@ Here are some examples:
319319
\A(?s:.*# pragma: exclude file.*)\Z
320320

321321
.. code-tab:: toml
322-
:caption: pyproject.toml
322+
:caption: .coveragerc.toml or pyproject.toml
323323

324324
[tool.coverage.report]
325325
exclude_also = [
@@ -343,7 +343,7 @@ Here are some examples:
343343
; 3. A pragma comment that excludes an entire file:
344344
\A(?s:.*# pragma: exclude file.*)\Z
345345

346-
.. [[[end]]] (sum: xG6Bmtmh06)
346+
.. [[[end]]] (sum: 3EupeurnDP)
347347
348348
The first regex matches a specific except line followed by a specific function
349349
call. Both lines must be present for the exclusion to take effect. Note that

doc/messages.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ file:
187187
disable_warnings = no-data-collected
188188

189189
.. code-tab:: toml
190-
:caption: pyproject.toml
190+
:caption: .coveragerc.toml or pyproject.toml
191191

192192
[tool.coverage.run]
193193
disable_warnings = ["no-data-collected"]
@@ -198,4 +198,4 @@ file:
198198
[coverage:run]
199199
disable_warnings = no-data-collected
200200

201-
.. [[[end]]] (sum: SJKFvPoXO2)
201+
.. [[[end]]] (sum: lZkA6+wMrL)

doc/plugins.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ a coverage.py plug-in called ``something.plugin``.
7272
something.plugin
7373

7474
.. code-tab:: toml
75-
:caption: pyproject.toml
75+
:caption: .coveragerc.toml or pyproject.toml
7676

7777
[tool.coverage.run]
7878
plugins = [ "something.plugin" ]
@@ -84,7 +84,7 @@ a coverage.py plug-in called ``something.plugin``.
8484
plugins =
8585
something.plugin
8686

87-
.. [[[end]]] (sum: boZjI9S8MZ)
87+
.. [[[end]]] (sum: 7iXDMHhoLG)
8888
8989
#. If the plug-in needs its own configuration, you can add those settings in
9090
the .coveragerc file in a section named for the plug-in:
@@ -114,7 +114,7 @@ a coverage.py plug-in called ``something.plugin``.
114114
option2 = abc.foo
115115

116116
.. code-tab:: toml
117-
:caption: pyproject.toml
117+
:caption: .coveragerc.toml or pyproject.toml
118118

119119
[tool.coverage.something.plugin]
120120
option1 = true
@@ -127,7 +127,7 @@ a coverage.py plug-in called ``something.plugin``.
127127
option1 = True
128128
option2 = abc.foo
129129

130-
.. [[[end]]] (sum: tpARXb5/bH)
130+
.. [[[end]]] (sum: QeURQmX7B1)
131131
132132
Check the documentation for the plug-in for details on the options it takes.
133133

doc/source.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ current directory:
115115
utils/tirefire.py
116116

117117
.. code-tab:: toml
118-
:caption: pyproject.toml
118+
:caption: .coveragerc.toml or pyproject.toml
119119

120120
[tool.coverage.run]
121121
omit = [
@@ -139,7 +139,7 @@ current directory:
139139
# omit this single file
140140
utils/tirefire.py
141141

142-
.. [[[end]]] (sum: hK0nQ8wMeg)
142+
.. [[[end]]] (sum: 6pS//9tCe4)
143143
144144
The ``source``, ``include``, and ``omit`` values all work together to determine
145145
the source that will be measured.

tests/test_config.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,19 +1037,25 @@ def test_exceptions_from_missing_toml_things(self, filename) -> None:
10371037

10381038
def test_coveragerc_toml_priority(self) -> None:
10391039
"""Test that .coveragerc.toml has priority over pyproject.toml."""
1040-
self.make_file(".coveragerc.toml", """\
1040+
self.make_file(
1041+
".coveragerc.toml",
1042+
"""\
10411043
[tool.coverage.run]
10421044
timid = true
10431045
data_file = ".toml-data.dat"
10441046
branch = true
1045-
""")
1047+
""",
1048+
)
10461049

1047-
self.make_file("pyproject.toml", """\
1050+
self.make_file(
1051+
"pyproject.toml",
1052+
"""\
10481053
[tool.coverage.run]
10491054
timid = false
10501055
data_file = "pyproject-data.dat"
10511056
branch = false
1052-
""")
1057+
""",
1058+
)
10531059
cov = coverage.Coverage()
10541060

10551061
assert cov.config.timid is True

0 commit comments

Comments
 (0)