@@ -195,7 +195,7 @@ user code and third-party libraries, as recommended by :pep:`565`.
195195This helps users keep their code modern and avoid breakages when deprecated warnings are effectively removed.
196196
197197However, in the specific case where users capture any type of warnings in their test, either with
198- :func: `pytest.warns `, :func: `pytest.deprecated_call ` or using the :ref : `recwarn < recwarn > ` fixture,
198+ :func: `pytest.warns `, :func: `pytest.deprecated_call ` or using the :fixture : `recwarn ` fixture,
199199no warning will be displayed at all.
200200
201201Sometimes it is useful to hide some specific deprecation warnings that happen in code that you have no control over
@@ -332,10 +332,10 @@ additional information:
332332 assert record[0 ].message.args[0 ] == " another warning"
333333
334334 Alternatively, you can examine raised warnings in detail using the
335- :ref : `recwarn < recwarn > ` fixture (see below).
335+ :fixture : `recwarn ` fixture (see :ref: ` below < recwarn >` ).
336336
337337
338- The :ref : `recwarn < recwarn > ` fixture automatically ensures to reset the warnings
338+ The :fixture : `recwarn ` fixture automatically ensures to reset the warnings
339339filter at the end of the test, so no global state is leaked.
340340
341341.. _`recording warnings` :
@@ -345,8 +345,8 @@ filter at the end of the test, so no global state is leaked.
345345Recording warnings
346346------------------
347347
348- You can record raised warnings either using :func: `pytest.warns ` or with
349- the `` recwarn ` ` fixture.
348+ You can record raised warnings either using the :func: `pytest.warns ` context manager or with
349+ the :fixture: ` recwarn ` fixture.
350350
351351To record with :func: `pytest.warns ` without asserting anything about the warnings,
352352pass no arguments as the expected warning type and it will default to a generic Warning:
@@ -361,7 +361,7 @@ pass no arguments as the expected warning type and it will default to a generic
361361 assert str (record[0 ].message) == " user"
362362 assert str (record[1 ].message) == " runtime"
363363
364- The `` recwarn ` ` fixture will record warnings for the whole function:
364+ The :fixture: ` recwarn ` fixture will record warnings for the whole function:
365365
366366.. code-block :: python
367367
@@ -377,12 +377,11 @@ The ``recwarn`` fixture will record warnings for the whole function:
377377 assert w.filename
378378 assert w.lineno
379379
380- Both `` recwarn `` and :func: `pytest.warns ` return the same interface for recorded
381- warnings: a WarningsRecorder instance. To view the recorded warnings, you can
380+ Both the :fixture: ` recwarn ` fixture and the :func: `pytest.warns ` context manager return the same interface for recorded
381+ warnings: a :class: ` ~_pytest.recwarn. WarningsRecorder` instance. To view the recorded warnings, you can
382382iterate over this instance, call ``len `` on it to get the number of recorded
383383warnings, or index into it to get a particular recorded warning.
384384
385- Full API: :class: `~_pytest.recwarn.WarningsRecorder `.
386385
387386.. _`warns use cases` :
388387
0 commit comments