We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using logging basicConfig in two tests in the same suite, the settings seem to overlap and interfere with each other.
basicConfig
I'm using pytest version 3.0.4 on Mac OSX Sierra
Here is a minimal example:
Create the following two files:
test_1.py
import logging logging.basicConfig() log = logging.getLogger() def test_foo(): foo = 1 log.warn(foo) assert foo == 1
test_2.py
from io import StringIO import logging log_stream = StringIO() def test_log(): logging.basicConfig(stream=log_stream, level=logging.INFO) log = logging.getLogger() log.warn('test') assert log_stream.getvalue() == 'WARNING:root:test\n'
Then run python3 -m pytest -v. Note that running each test individually works. The settings should not interfere, since they are in separate files.
python3 -m pytest -v
The text was updated successfully, but these errors were encountered:
As discussed in #2159, the recommendation (at least for now) is to use the pytest-catchlog plugin.
Sorry, something went wrong.
No branches or pull requests
When using logging
basicConfig
in two tests in the same suite, the settings seem to overlap and interfere with each other.I'm using pytest version 3.0.4 on Mac OSX Sierra
Here is a minimal example:
Create the following two files:
test_1.py
test_2.py
Then run
python3 -m pytest -v
. Note that running each test individually works. The settings should not interfere, since they are in separate files.The text was updated successfully, but these errors were encountered: