-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: I/O operation on closed file
when logging atexit
#5577
Labels
Comments
Thx for the report!
|
This is related to #5502. |
nicoddemus
added
plugin: logging
related to the logging builtin plugin
type: bug
problem that needs to be addressed
labels
Jul 8, 2019
Closing this as a duplicate of #5502 That said, thanks for providing a reproducible example! That really, really helps to narrow down the problem and there wasn't one on the older issue 😄 |
ethho
pushed a commit
to TACC-Cloud/python-reactors
that referenced
this issue
Sep 7, 2021
tchaikov
added a commit
to tchaikov/scylla-cluster-tests
that referenced
this issue
Apr 10, 2023
pytest's capsys just closes the stdout when done with tests. there are issues tracking this problem, see pytest-dev/pytest#5577 . but we adds a handler which redirect the logging messages to stdout. so, once pytest finishes testing, exceptions are raised when writing logging messages, like ``` 22:37:20 File "/usr/local/lib/python3.10/logging/__init__.py", line 1101, in emit 22:37:20 stream.write(msg + self.terminator) 22:37:20 ValueError: I/O operation on closed file. ``` so, in this change, `logging.raiseExceptions` is disabled when pytest's session finishes. Fixes scylladb#6000 Signed-off-by: Kefu Chai <[email protected]>
7 tasks
fruch
pushed a commit
to scylladb/scylla-cluster-tests
that referenced
this issue
Apr 10, 2023
pytest's capsys just closes the stdout when done with tests. there are issues tracking this problem, see pytest-dev/pytest#5577 . but we adds a handler which redirect the logging messages to stdout. so, once pytest finishes testing, exceptions are raised when writing logging messages, like ``` 22:37:20 File "/usr/local/lib/python3.10/logging/__init__.py", line 1101, in emit 22:37:20 stream.write(msg + self.terminator) 22:37:20 ValueError: I/O operation on closed file. ``` so, in this change, `logging.raiseExceptions` is disabled when pytest's session finishes. Fixes #6000 Signed-off-by: Kefu Chai <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
When writing unit tests involving ROS, py.test often crashes at the end of the test execution with:
After some debugging I can reproduce the problem in a minimal example:
The problem seems to be that importing this module auto-registers an
atexit
callback which involves a logging call.In the case of ROS the offending module is
rospy/core.py
. Since this file is tied to the entire ROS distribution there is no easy way to fix the problem on the ROS side.Python: 2.7
pip freeze
The text was updated successfully, but these errors were encountered: