(config: Config)
| 31 | |
| 32 | |
| 33 | def 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 | |
| 48 | def pytest_unconfigure(config: Config) -> None: |
nothing calls this directly
no test coverage detected