-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
ValueError: I/O operation on closed file #11572
Copy link
Copy link
Closed
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressed
Description
This is a follow-up to this issue #11439
Now the exception comes from sys.__stderr__.fileno()
Maybe it would be better to stash the original value of stderr and use that in unconfigure rather than trying to get it by calling fileno()? Happy to supply a patch.
Traceback (most recent call last):
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/faulthandler.py", line 47, in get_stderr_fileno
fileno = sys.stderr.fileno()
ValueError: I/O operation on closed file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/venv3.9/bin/pytest", line 8, in <module>
sys.exit(console_main())
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/config/__init__.py", line 192, in console_main
code = main()
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/config/__init__.py", line 169, in main
ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_hooks.py", line 493, in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_manager.py", line 115, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_callers.py", line 113, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_callers.py", line 77, in _multicall
res = hook_impl.function(*args)
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/main.py", line 318, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/main.py", line 313, in wrap_session
config._ensure_unconfigure()
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1058, in _ensure_unconfigure
self.hook.pytest_unconfigure(config=self)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_hooks.py", line 493, in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_manager.py", line 115, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_callers.py", line 113, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/home/venv3.9/lib/python3.9/site-packages/pluggy/_callers.py", line 77, in _multicall
res = hook_impl.function(*args)
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/faulthandler.py", line 42, in pytest_unconfigure
faulthandler.enable(file=get_stderr_fileno())
File "/home/venv3.9/lib/python3.9/site-packages/_pytest/faulthandler.py", line 57, in get_stderr_fileno
return sys.__stderr__.fileno()
ValueError: I/O operation on closed fileEnvironment
Python 3.9.10
Platform Linux-5.4.226-129.415.amzn2.x86_64-x86_64-with-glibc2.31
Packages
pytest: 7.4.3
pluggy: 1.3.0
Plugins
Faker: 19.6.2
anyio: 4.0.0
cov: 4.1.0
csv: 3.0.0
django: 4.5.2
factoryboy: 2.5.1
flake8: 1.1.1
html: 4.0.2
icdiff: 0.7
instafail: 0.5.0
isort: 3.1.0
metadata: 3.0.0
mock: 3.11.1
mypy: 0.10.3
ordering: 0.6
randomly: 3.15.0
subprocess: 1.5.0
timeout: 2.1.0
xdist: 3.3.1
typeguard: 2.13.3Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressed