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

Function warning_record_to_str

src/_pytest/warnings.py:84–94  ·  view source on GitHub ↗

Convert a warnings.WarningMessage to a string.

(warning_message: warnings.WarningMessage)

Source from the content-addressed store, hash-verified

82
83
84def warning_record_to_str(warning_message: warnings.WarningMessage) -> str:
85 """Convert a warnings.WarningMessage to a string."""
86 warn_msg = warning_message.message
87 msg = warnings.formatwarning(
88 str(warn_msg),
89 warning_message.category,
90 warning_message.filename,
91 warning_message.lineno,
92 warning_message.line,
93 )
94 return msg
95
96
97@pytest.hookimpl(hookwrapper=True, tryfirst=True)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected