From 53b931e21a9b9f9e82c40b41b6f49215902c7f93 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sat, 21 Jan 2023 23:03:57 +0100 Subject: [PATCH] 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 Co-authored-by: Erik Montnemery --- tests/conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index a3a4c8eb113..606e8194def 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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.