Skip to content

Commit 313a884

Browse files
committed
Warn that warning-capture can break existing suites in the docs and CHANGELOG
Related to discussion in #2430
1 parent 17f6470 commit 313a884

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGELOG.rst

+16-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,25 @@
55
New Features
66
------------
77

8-
* The ``pytest-warnings`` plugin has been integrated into the core, so now ``pytest`` automatically
8+
* The ``pytest-warnings`` plugin has been integrated into the core and now ``pytest`` automatically
99
captures and displays warnings at the end of the test session.
10+
11+
.. warning::
12+
13+
This feature may disrupt test suites which apply and treat warnings themselves, and can be
14+
disabled in your ``pytest.ini``:
15+
16+
.. code-block:: ini
17+
18+
[pytest]
19+
addopts = -p no:warnings
20+
21+
See the `warnings documentation page <https://docs.pytest.org/en/latest/warnings.html>`_ for more
22+
information.
23+
1024
Thanks `@nicoddemus`_ for the PR.
1125

12-
* Added ``junit_suite_name`` ini option to specify root `<testsuite>` name for JUnit XML reports (`#533`_).
26+
* Added ``junit_suite_name`` ini option to specify root ``<testsuite>`` name for JUnit XML reports (`#533`_).
1327

1428
* Added an ini option ``doctest_encoding`` to specify which encoding to use for doctest files.
1529
Thanks `@wheerd`_ for the PR (`#2101`_).

doc/en/warnings.rst

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ Warnings Capture
55

66
.. versionadded:: 3.1
77

8+
.. warning::
9+
pytest captures all warnings between tests, which prevents custom warning
10+
filters in existing test suites from working. If this causes problems to your test suite,
11+
this plugin can be disabled in your ``pytest.ini`` file with:
12+
13+
.. code-block:: ini
14+
15+
[pytest]
16+
addopts = -p no:warnings
17+
18+
There's an ongoing discussion about this on `#2430
19+
<https://github.com/pytest-dev/pytest/issues/2430>`_.
20+
21+
822
Starting from version ``3.1``, pytest now automatically catches all warnings during test execution
923
and displays them at the end of the session::
1024

tox.ini

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ commands=
4646

4747

4848
[testenv:linting]
49+
skipsdist=True
50+
usedevelop=True
4951
basepython = python2.7
5052
# needed to keep check-manifest working
5153
setenv =

0 commit comments

Comments
 (0)