MCPcopy
hub / github.com/pytest-dev/pytest / test_recwarn_captures_deprecation_warning

Function test_recwarn_captures_deprecation_warning

testing/test_recwarn.py:34–41  ·  view source on GitHub ↗

Check that recwarn can capture DeprecationWarning by default without custom filterwarnings (see #8666).

(recwarn: WarningsRecorder)

Source from the content-addressed store, hash-verified

32
33@pytest.mark.filterwarnings("")
34def test_recwarn_captures_deprecation_warning(recwarn: WarningsRecorder) -> None:
35 """
36 Check that recwarn can capture DeprecationWarning by default
37 without custom filterwarnings (see #8666).
38 """
39 warnings.warn(DeprecationWarning("some deprecation"))
40 assert len(recwarn) == 1
41 assert recwarn.pop(DeprecationWarning)
42
43
44class TestSubclassWarningPop:

Callers

nothing calls this directly

Calls 2

popMethod · 0.80
warnMethod · 0.45

Tested by

no test coverage detected