Add links to pytest.raises `message` workaround (#5218)
Add links to pytest.raises `message` workaround
This commit is contained in:
commit
dcf65a9643
|
@ -19,6 +19,8 @@ Below is a complete list of all pytest features which are considered deprecated.
|
||||||
:class:`_pytest.warning_types.PytestWarning` or subclasses, which can be filtered using
|
:class:`_pytest.warning_types.PytestWarning` or subclasses, which can be filtered using
|
||||||
:ref:`standard warning filters <warnings>`.
|
:ref:`standard warning filters <warnings>`.
|
||||||
|
|
||||||
|
.. _`raises message deprecated`:
|
||||||
|
|
||||||
``"message"`` parameter of ``pytest.raises``
|
``"message"`` parameter of ``pytest.raises``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ Run multiple tests
|
||||||
Assert that a certain exception is raised
|
Assert that a certain exception is raised
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
Use the ``raises`` helper to assert that some code raises an exception::
|
Use the :ref:`raises <assertraises>` helper to assert that some code raises an exception::
|
||||||
|
|
||||||
# content of test_sysexit.py
|
# content of test_sysexit.py
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -561,7 +561,7 @@ def raises(expected_exception, *args, **kwargs):
|
||||||
:kwparam match: if specified, asserts that the exception matches a text or regex
|
:kwparam match: if specified, asserts that the exception matches a text or regex
|
||||||
|
|
||||||
:kwparam message: **(deprecated since 4.1)** if specified, provides a custom failure message
|
:kwparam message: **(deprecated since 4.1)** if specified, provides a custom failure message
|
||||||
if the exception is not raised
|
if the exception is not raised. See :ref:`the deprecation docs <raises message deprecated>` for a workaround.
|
||||||
|
|
||||||
.. currentmodule:: _pytest._code
|
.. currentmodule:: _pytest._code
|
||||||
|
|
||||||
|
@ -597,6 +597,7 @@ def raises(expected_exception, *args, **kwargs):
|
||||||
``message`` to specify a custom failure message that will be displayed
|
``message`` to specify a custom failure message that will be displayed
|
||||||
in case the ``pytest.raises`` check fails. This has been deprecated as it
|
in case the ``pytest.raises`` check fails. This has been deprecated as it
|
||||||
is considered error prone as users often mean to use ``match`` instead.
|
is considered error prone as users often mean to use ``match`` instead.
|
||||||
|
See :ref:`the deprecation docs <raises message deprecated>` for a workaround.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue