Merge pull request #2439 from nicoddemus/warnings-docs

Warn that warning-capture can break existing suites in the docs and CHANGELOG
This commit is contained in:
Floris Bruynooghe 2017-05-29 13:34:39 +02:00 committed by GitHub
commit 7bb06b6dad
3 changed files with 32 additions and 2 deletions

View File

@ -11,11 +11,25 @@
New Features New Features
------------ ------------
* The ``pytest-warnings`` plugin has been integrated into the core, so now ``pytest`` automatically * The ``pytest-warnings`` plugin has been integrated into the core and now ``pytest`` automatically
captures and displays warnings at the end of the test session. captures and displays warnings at the end of the test session.
.. warning::
This feature may disrupt test suites which apply and treat warnings themselves, and can be
disabled in your ``pytest.ini``:
.. code-block:: ini
[pytest]
addopts = -p no:warnings
See the `warnings documentation page <https://docs.pytest.org/en/latest/warnings.html>`_ for more
information.
Thanks `@nicoddemus`_ for the PR. Thanks `@nicoddemus`_ for the PR.
* Added ``junit_suite_name`` ini option to specify root `<testsuite>` name for JUnit XML reports (`#533`_). * Added ``junit_suite_name`` ini option to specify root ``<testsuite>`` name for JUnit XML reports (`#533`_).
* Added an ini option ``doctest_encoding`` to specify which encoding to use for doctest files. * Added an ini option ``doctest_encoding`` to specify which encoding to use for doctest files.
Thanks `@wheerd`_ for the PR (`#2101`_). Thanks `@wheerd`_ for the PR (`#2101`_).

View File

@ -5,6 +5,20 @@ Warnings Capture
.. versionadded:: 3.1 .. versionadded:: 3.1
.. warning::
pytest captures all warnings between tests, which prevents custom warning
filters in existing test suites from working. If this causes problems to your test suite,
this plugin can be disabled in your ``pytest.ini`` file with:
.. code-block:: ini
[pytest]
addopts = -p no:warnings
There's an ongoing discussion about this on `#2430
<https://github.com/pytest-dev/pytest/issues/2430>`_.
Starting from version ``3.1``, pytest now automatically catches all warnings during test execution Starting from version ``3.1``, pytest now automatically catches all warnings during test execution
and displays them at the end of the session:: and displays them at the end of the session::

View File

@ -46,6 +46,8 @@ commands=
[testenv:linting] [testenv:linting]
skipsdist=True
usedevelop=True
basepython = python2.7 basepython = python2.7
# needed to keep check-manifest working # needed to keep check-manifest working
setenv = setenv =