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

Function pytest_load_initial_conftests

src/_pytest/capture.py:156–180  ·  view source on GitHub ↗
(early_config: Config)

Source from the content-addressed store, hash-verified

154
155@hookimpl(wrapper=True)
156def pytest_load_initial_conftests(early_config: Config) -> Generator[None]:
157 ns = early_config.known_args_namespace
158 if ns.capture == "fd":
159 _windowsconsoleio_workaround(sys.stdout)
160 _colorama_workaround()
161 _readline_workaround()
162 pluginmanager = early_config.pluginmanager
163 capman = CaptureManager(ns.capture)
164 pluginmanager.register(capman, "capturemanager")
165
166 # Make sure that capturemanager is properly reset at final shutdown.
167 early_config.add_cleanup(capman.stop_global_capturing)
168
169 # Finally trigger conftest loading but while capturing (issue #93).
170 capman.start_global_capturing()
171 try:
172 try:
173 yield
174 finally:
175 capman.suspend_global_capture()
176 except BaseException:
177 out, err = capman.read_global_capture()
178 sys.stdout.write(out)
179 sys.stderr.write(err)
180 raise
181
182
183# IO Helpers.

Callers

nothing calls this directly

Calls 10

read_global_captureMethod · 0.95
_colorama_workaroundFunction · 0.85
_readline_workaroundFunction · 0.85
CaptureManagerClass · 0.85
registerMethod · 0.80
add_cleanupMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected