@@ -186,7 +186,7 @@ Add warning filters to marked test items.
186186
187187 .. code-block :: python
188188
189- @pytest.mark.filterwarnings (" ignore:.*usage will be deprecated.*:DeprecationWarning" )
189+ @pytest.mark.filterwarnings (r " ignore:. * usage will be deprecated. * :DeprecationWarning" )
190190 def test_foo (): ...
191191
192192
@@ -1587,9 +1587,8 @@ passed multiple times. The expected format is ``name=value``. For example::
15871587 For more information please refer to :ref: `faulthandler `.
15881588 For more information please refer to :ref: `faulthandler `.
15891589
1590- .. confval :: filterwarnings
1591-
15921590
1591+ .. confval :: filterwarnings
15931592
15941593 Sets a list of filters and actions that should be taken for matched
15951594 warnings. By default all warnings emitted during the test session
@@ -1600,7 +1599,12 @@ passed multiple times. The expected format is ``name=value``. For example::
16001599 .. code-block :: toml
16011600
16021601 [pytest]
1603- filterwarnings = ["error", "ignore::DeprecationWarning"]
1602+ filterwarnings = [
1603+ 'error',
1604+ 'ignore::DeprecationWarning',
1605+ # Note the use of single quote below to denote "raw" strings in TOML.
1606+ 'ignore:function ham\(\) should not be used:UserWarning',
1607+ ]
16041608
16051609 .. tab :: ini
16061610
@@ -1610,6 +1614,7 @@ passed multiple times. The expected format is ``name=value``. For example::
16101614 filterwarnings =
16111615 error
16121616 ignore::DeprecationWarning
1617+ ignore:function ham\(\) should not be used:UserWarning
16131618
16141619 This tells pytest to ignore deprecation warnings and turn all other warnings
16151620 into errors. For more information please refer to :ref: `warnings `.
0 commit comments