diff options
author | Buck Golemon <buck@yelp.com> | 2015-12-07 14:27:41 -0800 |
---|---|---|
committer | Buck Golemon <buck@yelp.com> | 2015-12-07 14:28:59 -0800 |
commit | eabf2f909100741f63ce69884c186ab20410ceb3 (patch) | |
tree | 9cd90957e365105dce63ed41d28e87c302cf2e32 /doc/en/recwarn.rst | |
parent | 84eacf3e3c73d11afcb3a194c20dc9a3d46357c4 (diff) | |
parent | ffa572531a8569377589860ff202e2af2ee45844 (diff) | |
download | pytest-eabf2f909100741f63ce69884c186ab20410ceb3.tar.gz |
Merge branch 'master' into features
Conflicts:
AUTHORS
_pytest/__init__.py
_pytest/hookspec.py
_pytest/recwarn.py
testing/test_recwarn.py
Diffstat (limited to 'doc/en/recwarn.rst')
-rw-r--r-- | doc/en/recwarn.rst | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/en/recwarn.rst b/doc/en/recwarn.rst index ead162f4e..3c42bfaaf 100644 --- a/doc/en/recwarn.rst +++ b/doc/en/recwarn.rst @@ -41,6 +41,10 @@ additional information:: Alternatively, you can examine raised warnings in detail using the :ref:`recwarn <recwarn>` fixture (see below). +.. note:: + ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated + differently; see :ref:`ensuring_function_triggers`. + .. _recwarn: Recording warnings @@ -87,6 +91,9 @@ Each recorded warning has the attributes ``message``, ``category``, class of the warning. The ``message`` is the warning itself; calling ``str(message)`` will return the actual message of the warning. +.. note:: + ``DeprecationWarning`` and ``PendingDeprecationWarning`` are treated + differently; see :ref:`ensuring_function_triggers`. .. _ensuring_function_triggers: @@ -94,16 +101,17 @@ Ensuring a function triggers a deprecation warning ------------------------------------------------------- You can also call a global helper for checking -that a certain function call triggers a ``DeprecationWarning``:: +that a certain function call triggers a ``DeprecationWarning`` or +``PendingDeprecationWarning``:: import pytest def test_global(): pytest.deprecated_call(myfunction, 17) -By default, deprecation warnings will not be caught when using ``pytest.warns`` -or ``recwarn``, since the default Python warnings filters hide -DeprecationWarnings. If you wish to record them in your own code, use the +By default, ``DeprecationWarning`` and ``PendingDeprecationWarning`` will not be +caught when using ``pytest.warns`` or ``recwarn`` because default Python warnings filters hide +them. If you wish to record them in your own code, use the command ``warnings.simplefilter('always')``:: import warnings |