| 60 | |
| 61 | |
| 62 | def get_stderr_fileno() -> int: |
| 63 | try: |
| 64 | fileno = sys.stderr.fileno() |
| 65 | # The Twisted Logger will return an invalid file descriptor since it is not backed |
| 66 | # by an FD. So, let's also forward this to the same code path as with pytest-xdist. |
| 67 | if fileno == -1: |
| 68 | raise AttributeError() |
| 69 | return fileno |
| 70 | except (AttributeError, ValueError): |
| 71 | # pytest-xdist monkeypatches sys.stderr with an object that is not an actual file. |
| 72 | # https://docs.python.org/3/library/faulthandler.html#issue-with-file-descriptors |
| 73 | # This is potentially dangerous, but the best we can do. |
| 74 | assert sys.__stderr__ is not None |
| 75 | return sys.__stderr__.fileno() |
| 76 | |
| 77 | |
| 78 | def get_timeout_config_value(config: Config) -> float: |