Open thclark opened 2 years ago
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: https://github.com/pytest-dev/pytest/issues/5743
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.
Bug report
What is the current behavior?
We are leaking global logger state across tests, and as a result get a pytest error:
The issue is as described here: https://github.com/pytest-dev/pytest/issues/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.