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

Function pytest_unconfigure

src/_pytest/pastebin.py:52–66  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

50
51
52def pytest_unconfigure(config: Config) -> None:
53 if pastebinfile_key in config.stash:
54 pastebinfile = config.stash[pastebinfile_key]
55 # Get terminal contents and delete file.
56 pastebinfile.seek(0)
57 sessionlog = pastebinfile.read()
58 pastebinfile.close()
59 del config.stash[pastebinfile_key]
60 # Undo our patching in the terminal reporter.
61 tr = config.pluginmanager.getplugin("terminalreporter")
62 del tr._tw.__dict__["write"]
63 # Write summary.
64 tr.write_sep("=", "Sending information to Paste Service")
65 pastebinurl = create_new_paste(sessionlog)
66 tr.write_line("pastebin session-log: %s\n" % pastebinurl)
67
68
69def create_new_paste(contents: Union[str, bytes]) -> str:

Callers

nothing calls this directly

Calls 6

create_new_pasteFunction · 0.85
getpluginMethod · 0.80
write_sepMethod · 0.80
write_lineMethod · 0.80
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected