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

Function unraisable_exception_runtest_hook

src/_pytest/unraisableexception.py:62–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61
62def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
63 with catch_unraisable_exception() as cm:
64 yield
65 if cm.unraisable:
66 if cm.unraisable.err_msg is not None:
67 err_msg = cm.unraisable.err_msg
68 else:
69 err_msg = "Exception ignored in"
70 msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
71 msg += "".join(
72 traceback.format_exception(
73 cm.unraisable.exc_type,
74 cm.unraisable.exc_value,
75 cm.unraisable.exc_traceback,
76 )
77 )
78 warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
79
80
81@pytest.hookimpl(hookwrapper=True, tryfirst=True)

Callers 3

pytest_runtest_setupFunction · 0.85
pytest_runtest_callFunction · 0.85
pytest_runtest_teardownFunction · 0.85

Calls 2

warnMethod · 0.45

Tested by

no test coverage detected