Skip to content

Commit

Permalink
docs: final paperwork for exclude_also #1557
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Feb 22, 2023
1 parent 2a0e7bc commit cc0c0ea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------

- Added a new setting ``[report] exclude_also`` to let you add more exclusions
without overwriting the defaults. Thanks, `Alpha Chen <pull 1557_>`_,
closing `issue 1391_`.

- Added a :meth:`.CoverageData.purge_files` method to remove recorded data for
a particular file. Contributed by `Stephan Deibel <pull 1547_>`_.

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

.. _issue 1391: https://github.com/nedbat/coveragepy/issues/1391
.. _issue 1542: https://github.com/nedbat/coveragepy/issues/1542
.. _pull 1543: https://github.com/nedbat/coveragepy/pull/1543
.. _pull 1547: https://github.com/nedbat/coveragepy/pull/1547
.. _pull 1550: https://github.com/nedbat/coveragepy/pull/1550
.. _issue 1552: https://github.com/nedbat/coveragepy/issues/1552
.. _pull 1557: https://github.com/nedbat/coveragepy/pull/1557


.. scriv-start-here
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Alex Groce
Alex Sandro
Alexander Todorov
Alexander Walters
Alpha Chen
Ammar Askar
Andrew Hoos
Anthony Sottile
Expand Down
9 changes: 6 additions & 3 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,12 @@ you'll exclude any line with three or more of any character. If you write
[report] exclude_also
.....................

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

.. versionadded:: 7.2.0


.. _config_report_fail_under:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,12 @@ def test_exceptions_from_missing_things(self) -> None:
def test_exclude_also(self) -> None:
self.make_file("pyproject.toml", """\
[tool.coverage.report]
exclude_also = ["foobar"]
exclude_also = ["foobar", "raise .*Error"]
""")
cov = coverage.Coverage()

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


class ConfigFileTest(UsingModulesMixin, CoverageTest):
Expand Down

0 comments on commit cc0c0ea

Please sign in to comment.