summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-02-22 17:13:40 -0500
committerNed Batchelder <ned@nedbatchelder.com>2023-02-22 17:13:49 -0500
commitcc0c0ea4b2af02e8bf4c21f708afa6988e1b4fda (patch)
tree3501e36fd9249b1b6a81cfcc35ef867120ca86d7
parent2a0e7bc17f932e33ef9c437760ae2f9f60b46390 (diff)
downloadpython-coveragepy-git-cc0c0ea4b2af02e8bf4c21f708afa6988e1b4fda.tar.gz
docs: final paperwork for exclude_also #1557
-rw-r--r--CHANGES.rst7
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--doc/config.rst9
-rw-r--r--tests/test_config.py5
4 files changed, 17 insertions, 5 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 1c27501d..d2db59c9 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -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_>`_.
@@ -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
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 8889ed61..f9f028a4 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -14,6 +14,7 @@ Alex Groce
Alex Sandro
Alexander Todorov
Alexander Walters
+Alpha Chen
Ammar Askar
Andrew Hoos
Anthony Sottile
diff --git a/doc/config.rst b/doc/config.rst
index 5b159d90..152b3af4 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -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:
diff --git a/tests/test_config.py b/tests/test_config.py
index 2befa2e3..6739a426 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -452,11 +452,12 @@ class ConfigTest(CoverageTest):
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):