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

Function _postmortem_traceback

src/_pytest/debugging.py:367–380  ·  view source on GitHub ↗
(excinfo: ExceptionInfo[BaseException])

Source from the content-addressed store, hash-verified

365
366
367def _postmortem_traceback(excinfo: ExceptionInfo[BaseException]) -> types.TracebackType:
368 from doctest import UnexpectedException
369
370 if isinstance(excinfo.value, UnexpectedException):
371 # A doctest.UnexpectedException is not useful for post_mortem.
372 # Use the underlying exception instead:
373 return excinfo.value.exc_info[2]
374 elif isinstance(excinfo.value, ConftestImportFailure):
375 # A config.ConftestImportFailure is not useful for post_mortem.
376 # Use the underlying exception instead:
377 return excinfo.value.excinfo[2]
378 else:
379 assert excinfo._excinfo is not None
380 return excinfo._excinfo[2]
381
382
383def post_mortem(t: types.TracebackType) -> None:

Callers 2

pytest_internalerrorMethod · 0.85
_enter_pdbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected