MCPcopy
hub / github.com/stas00/ml-engineering / summary_failures_short

Function summary_failures_short

testing/testing_utils.py:1020–1032  ·  view source on GitHub ↗
(tr)

Source from the content-addressed store, hash-verified

1018 f.write(f"{rep.duration:02.2f}s {rep.when:<8} {rep.nodeid}\n")
1019
1020 def summary_failures_short(tr):
1021 # expecting that the reports were --tb=long (default) so we chop them off here to the last frame
1022 reports = tr.getreports("failed")
1023 if not reports:
1024 return
1025 tr.write_sep("=", "FAILURES SHORT STACK")
1026 for rep in reports:
1027 msg = tr._getfailureheadline(rep)
1028 tr.write_sep("_", msg, red=True, bold=True)
1029 # chop off the optional leading extra frames, leaving only the last one
1030 longrepr = re.sub(r".*_ _ _ (_ ){10,}_ _ ", "", rep.longreprtext, 0, re.M | re.S)
1031 tr._tw.line(longrepr)
1032 # note: not printing out any rep.sections to keep the report short
1033
1034 # use ready-made report funcs, we are just hijacking the filehandle to log to a dedicated file each
1035 # adapted from https://github.com/pytest-dev/pytest/blob/897f151e/src/_pytest/terminal.py#L814

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected