diff --git a/tests/conftest.py b/tests/conftest.py index f7688a9d..76a8ddee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,20 @@ import pytest +import tractor +from piker import log + + +def pytest_addoption(parser): + parser.addoption("--ll", action="store", dest='loglevel', + default=None, help="logging level to set when testing") + + +@pytest.fixture(scope='session', autouse=True) +def loglevel(request): + orig = tractor.log._default_loglevel + level = tractor.log._default_loglevel = request.config.option.loglevel + log.get_console_log(level) + yield level + tractor.log._default_loglevel = orig @pytest.fixture