MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_recwarn_captures_deprecation_warning

Function test_recwarn_captures_deprecation_warning

testing/test_recwarn.py:31–38  ·  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

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

Callers

nothing calls this directly

Calls 2

popMethod · 0.80
warnMethod · 0.45

Tested by

no test coverage detected