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

Function pytest_cmdline_parse

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

Source from the content-addressed store, hash-verified

121
122@pytest.hookimpl(wrapper=True)
123def pytest_cmdline_parse() -> Generator[None, Config, Config]:
124 config = yield
125
126 if config.option.debug:
127 # --debug | --debug <file.log> was provided.
128 path = config.option.debug
129 debugfile = open(path, "w", encoding="utf-8")
130 debugfile.write(
131 "versions pytest-{}, "
132 "python-{}\ninvocation_dir={}\ncwd={}\nargs={}\n\n".format(
133 pytest.__version__,
134 ".".join(map(str, sys.version_info)),
135 config.invocation_params.dir,
136 os.getcwd(),
137 config.invocation_params.args,
138 )
139 )
140 config.trace.root.setwriter(debugfile.write)
141 undo_tracing = config.pluginmanager.enable_tracing()
142 sys.stderr.write(f"writing pytest debug information to {path}\n")
143
144 def unset_tracing() -> None:
145 debugfile.close()
146 sys.stderr.write(f"wrote pytest debug information to {debugfile.name}\n")
147 config.trace.root.setwriter(None)
148 undo_tracing()
149
150 config.add_cleanup(unset_tracing)
151
152 return config
153
154
155def show_version_verbose(config: Config) -> None:

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
add_cleanupMethod · 0.80
writeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…