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

Function pytest_configure

src/_pytest/faulthandler.py:33–45  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

31
32
33def pytest_configure(config: Config) -> None:
34 import faulthandler
35
36 # at teardown we want to restore the original faulthandler fileno
37 # but faulthandler has no api to return the original fileno
38 # so here we stash the stderr fileno to be used at teardown
39 # sys.stderr and sys.__stderr__ may be closed or patched during the session
40 # so we can't rely on their values being good at that point (#11572).
41 stderr_fileno = get_stderr_fileno()
42 if faulthandler.is_enabled():
43 config.stash[fault_handler_original_stderr_fd_key] = stderr_fileno
44 config.stash[fault_handler_stderr_fd_key] = os.dup(stderr_fileno)
45 faulthandler.enable(file=config.stash[fault_handler_stderr_fd_key])
46
47
48def pytest_unconfigure(config: Config) -> None:

Callers

nothing calls this directly

Calls 1

get_stderr_filenoFunction · 0.85

Tested by

no test coverage detected