Skip to content

Commit

Permalink
Fix API links in 'How to capture warnings' documentation page (#8792)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau authored Jun 23, 2021
1 parent f573b56 commit 942789b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Iwan Briquemont
Jaap Broekhuizen
Jakob van Santen
Jakub Mitoraj
James Bourbeau
Jan Balster
Janne Vanhala
Jason R. Coombs
Expand Down
10 changes: 5 additions & 5 deletions doc/en/how-to/capture-warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Asserting warnings with the warns function



You can check that code raises a particular warning using func:`pytest.warns`,
You can check that code raises a particular warning using :func:`pytest.warns`,
which works in a similar manner to :ref:`raises <assertraises>`:

.. code-block:: python
Expand Down Expand Up @@ -272,7 +272,7 @@ argument ``match`` to assert that the exception matches a text or regex::
...
Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...

You can also call func:`pytest.warns` on a function or code string:
You can also call :func:`pytest.warns` on a function or code string:

.. code-block:: python
Expand Down Expand Up @@ -307,10 +307,10 @@ filter at the end of the test, so no global state is leaked.
Recording warnings
------------------

You can record raised warnings either using func:`pytest.warns` or with
You can record raised warnings either using :func:`pytest.warns` or with
the ``recwarn`` fixture.

To record with func:`pytest.warns` without asserting anything about the warnings,
To record with :func:`pytest.warns` without asserting anything about the warnings,
pass no arguments as the expected warning type and it will default to a generic Warning:

.. code-block:: python
Expand Down Expand Up @@ -339,7 +339,7 @@ The ``recwarn`` fixture will record warnings for the whole function:
assert w.filename
assert w.lineno
Both ``recwarn`` and func:`pytest.warns` return the same interface for recorded
Both ``recwarn`` and :func:`pytest.warns` return the same interface for recorded
warnings: a WarningsRecorder instance. To view the recorded warnings, you can
iterate over this instance, call ``len`` on it to get the number of recorded
warnings, or index into it to get a particular recorded warning.
Expand Down

0 comments on commit 942789b

Please sign in to comment.