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

Function pytest_cmdline_parse

src/_pytest/helpconfig.py:100–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99@pytest.hookimpl(hookwrapper=True)
100def pytest_cmdline_parse():
101 outcome = yield
102 config: Config = outcome.get_result()
103
104 if config.option.debug:
105 # --debug | --debug <file.log> was provided.
106 path = config.option.debug
107 debugfile = open(path, "w")
108 debugfile.write(
109 "versions pytest-%s, "
110 "python-%s\ncwd=%s\nargs=%s\n\n"
111 % (
112 pytest.__version__,
113 ".".join(map(str, sys.version_info)),
114 os.getcwd(),
115 config.invocation_params.args,
116 )
117 )
118 config.trace.root.setwriter(debugfile.write)
119 undo_tracing = config.pluginmanager.enable_tracing()
120 sys.stderr.write("writing pytest debug information to %s\n" % path)
121
122 def unset_tracing() -> None:
123 debugfile.close()
124 sys.stderr.write("wrote pytest debug information to %s\n" % debugfile.name)
125 config.trace.root.setwriter(None)
126 undo_tracing()
127
128 config.add_cleanup(unset_tracing)
129
130
131def showversion(config: Config) -> None:

Callers

nothing calls this directly

Calls 2

add_cleanupMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected