Skip to content

Commit 942789b

Browse files
authored
Fix API links in 'How to capture warnings' documentation page (#8792)
1 parent f573b56 commit 942789b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ Iwan Briquemont
144144
Jaap Broekhuizen
145145
Jakob van Santen
146146
Jakub Mitoraj
147+
James Bourbeau
147148
Jan Balster
148149
Janne Vanhala
149150
Jason R. Coombs

doc/en/how-to/capture-warnings.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ Asserting warnings with the warns function
244244

245245

246246

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

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

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

277277
.. code-block:: python
278278
@@ -307,10 +307,10 @@ filter at the end of the test, so no global state is leaked.
307307
Recording warnings
308308
------------------
309309

310-
You can record raised warnings either using func:`pytest.warns` or with
310+
You can record raised warnings either using :func:`pytest.warns` or with
311311
the ``recwarn`` fixture.
312312

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

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

0 commit comments

Comments
 (0)