Don't interpret negative verbosity as debug (#86318)

* Don't interpret negative verbosity as debug

CI run with -qq which is a negative verbosity

* Make sure all caplog tests get debug level

* Update tests/conftest.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
pull/86341/head^2
Joakim Plate 2023-01-21 23:03:57 +01:00 committed by GitHub
parent ca4d7634a8
commit 53b931e21a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -99,7 +99,7 @@ def pytest_configure(config):
config.addinivalue_line(
"markers", "no_fail_on_log_exception: mark test to not fail on logged exception"
)
if config.getoption("verbose"):
if config.getoption("verbose") > 0:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
@ -201,6 +201,13 @@ location.async_detect_location_info = check_real(location.async_detect_location_
util.get_local_ip = lambda: "127.0.0.1"
@pytest.fixture(name="caplog")
def caplog_fixture(caplog):
"""Set log level to debug for tests using the caplog fixture."""
caplog.set_level(logging.DEBUG)
yield caplog
@pytest.fixture(autouse=True, scope="module")
def garbage_collection():
"""Run garbage collection at known locations.