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

Function recwarn

src/_pytest/recwarn.py:29–38  ·  view source on GitHub ↗

Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. See https://docs.python.org/library/how-to/capture-warnings.html for information on warning categories.

()

Source from the content-addressed store, hash-verified

27
28@fixture
29def recwarn() -> Generator["WarningsRecorder", None, None]:
30 """Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
31
32 See https://docs.python.org/library/how-to/capture-warnings.html for information
33 on warning categories.
34 """
35 wrec = WarningsRecorder(_ispytest=True)
36 with wrec:
37 warnings.simplefilter("default")
38 yield wrec
39
40
41@overload

Callers

nothing calls this directly

Calls 1

WarningsRecorderClass · 0.85

Tested by

no test coverage detected