Skip to content

Commit cc0c0ea

Browse files
committed
docs: final paperwork for exclude_also #1557
1 parent 2a0e7bc commit cc0c0ea

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

Diff for: CHANGES.rst

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ development at the same time, such as 4.5.x and 5.0.
2020
Unreleased
2121
----------
2222

23+
- Added a new setting ``[report] exclude_also`` to let you add more exclusions
24+
without overwriting the defaults. Thanks, `Alpha Chen <pull 1557_>`_,
25+
closing `issue 1391_`.
26+
2327
- Added a :meth:`.CoverageData.purge_files` method to remove recorded data for
2428
a particular file. Contributed by `Stephan Deibel <pull 1547_>`_.
2529

@@ -39,11 +43,14 @@ Unreleased
3943
- Added a ``py.typed`` file to announce our type-hintedness. Thanks,
4044
`KotlinIsland <pull 1550_>`_.
4145

46+
.. _issue 1391: https://github.com/nedbat/coveragepy/issues/1391
4247
.. _issue 1542: https://github.com/nedbat/coveragepy/issues/1542
4348
.. _pull 1543: https://github.com/nedbat/coveragepy/pull/1543
4449
.. _pull 1547: https://github.com/nedbat/coveragepy/pull/1547
4550
.. _pull 1550: https://github.com/nedbat/coveragepy/pull/1550
4651
.. _issue 1552: https://github.com/nedbat/coveragepy/issues/1552
52+
.. _pull 1557: https://github.com/nedbat/coveragepy/pull/1557
53+
4754

4855
.. scriv-start-here
4956

Diff for: CONTRIBUTORS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Alex Groce
1414
Alex Sandro
1515
Alexander Todorov
1616
Alexander Walters
17+
Alpha Chen
1718
Ammar Askar
1819
Andrew Hoos
1920
Anthony Sottile

Diff for: doc/config.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,12 @@ you'll exclude any line with three or more of any character. If you write
400400
[report] exclude_also
401401
.....................
402402

403-
(multi-string) A list of regular expressions. This setting will preserve the
404-
default exclude pattern instead of overwriting it. See
405-
:ref:`config_report_exclude_lines` for details on exclusion regexes.
403+
(multi-string) A list of regular expressions. This setting is the same as
404+
:ref:`config_report_exclude_lines`: it adds patterns for lines to exclude from
405+
reporting. This setting will preserve the default exclude patterns instead of
406+
overwriting them.
407+
408+
.. versionadded:: 7.2.0
406409

407410

408411
.. _config_report_fail_under:

Diff for: tests/test_config.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,12 @@ def test_exceptions_from_missing_things(self) -> None:
452452
def test_exclude_also(self) -> None:
453453
self.make_file("pyproject.toml", """\
454454
[tool.coverage.report]
455-
exclude_also = ["foobar"]
455+
exclude_also = ["foobar", "raise .*Error"]
456456
""")
457457
cov = coverage.Coverage()
458458

459-
assert cov.config.exclude_list == coverage.config.DEFAULT_EXCLUDE + ["foobar"]
459+
expected = coverage.config.DEFAULT_EXCLUDE + ["foobar", "raise .*Error"]
460+
assert cov.config.exclude_list == expected
460461

461462

462463
class ConfigFileTest(UsingModulesMixin, CoverageTest):

0 commit comments

Comments
 (0)