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

Function serialize_exception_longrepr

src/_pytest/reports.py:479–500  ·  view source on GitHub ↗
(rep: BaseReport)

Source from the content-addressed store, hash-verified

477 return None
478
479 def serialize_exception_longrepr(rep: BaseReport) -> Dict[str, Any]:
480 assert rep.longrepr is not None
481 # TODO: Investigate whether the duck typing is really necessary here.
482 longrepr = cast(ExceptionRepr, rep.longrepr)
483 result: Dict[str, Any] = {
484 "reprcrash": serialize_repr_crash(longrepr.reprcrash),
485 "reprtraceback": serialize_repr_traceback(longrepr.reprtraceback),
486 "sections": longrepr.sections,
487 }
488 if isinstance(longrepr, ExceptionChainRepr):
489 result["chain"] = []
490 for repr_traceback, repr_crash, description in longrepr.chain:
491 result["chain"].append(
492 (
493 serialize_repr_traceback(repr_traceback),
494 serialize_repr_crash(repr_crash),
495 description,
496 )
497 )
498 else:
499 result["chain"] = None
500 return result
501
502 d = report.__dict__.copy()
503 if hasattr(report.longrepr, "toterminal"):

Callers 1

_report_to_jsonFunction · 0.85

Calls 3

serialize_repr_crashFunction · 0.85
serialize_repr_tracebackFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected