MCPcopy
hub / github.com/pytest-dev/pytest / pytest_terminal_summary

Function pytest_terminal_summary

src/_pytest/pastebin.py:105–121  ·  view source on GitHub ↗
(terminalreporter: TerminalReporter)

Source from the content-addressed store, hash-verified

103
104
105def pytest_terminal_summary(terminalreporter: TerminalReporter) -> None:
106 if terminalreporter.config.option.pastebin != "failed":
107 return
108 if "failed" in terminalreporter.stats:
109 terminalreporter.write_sep("=", "Sending information to Paste Service")
110 for rep in terminalreporter.stats["failed"]:
111 try:
112 msg = rep.longrepr.reprtraceback.reprentries[-1].reprfileloc
113 except AttributeError:
114 msg = terminalreporter._getfailureheadline(rep)
115 file = StringIO()
116 tw = create_terminal_writer(terminalreporter.config, file)
117 rep.toterminal(tw)
118 s = file.getvalue()
119 assert len(s)
120 pastebinurl = create_new_paste(s)
121 terminalreporter.write_line(f"{msg} --> {pastebinurl}")

Callers

nothing calls this directly

Calls 7

create_terminal_writerFunction · 0.90
create_new_pasteFunction · 0.85
write_sepMethod · 0.80
_getfailureheadlineMethod · 0.80
write_lineMethod · 0.80
toterminalMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected