Skip to content
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

log handling not idempotent across tests #83

Open
thclark opened this issue Jul 6, 2022 · 0 comments
Open

log handling not idempotent across tests #83

thclark opened this issue Jul 6, 2022 · 0 comments

Comments

@thclark
Copy link
Contributor

thclark commented Jul 6, 2022

Bug report

What is the current behavior?

We are leaking global logger state across tests, and as a result get a pytest error:

/usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2022.8.1/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear
cwd: .
[ERROR 2022-6-6 9:43:24.553]: Error discovering pytest tests:
 [n [Error]: --- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/logging/__init__.py", line 1086, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/local/lib/python3.9/multiprocessing/util.py", line 332, in _exit_function
    info('process shutting down')
  File "/usr/local/lib/python3.9/multiprocessing/util.py", line 54, in info
    _logger.log(INFO, msg, *args)
Message: 'process shutting down'
Arguments: ()

The issue is as described here: pytest-dev/pytest#5743

What is the expected behavior?

The log handlers need to be cleaned up on a per-test basis in order to allow the tests to run in an idempotent way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant