forked from goodboy/tractor
1
0
Fork 0

Disable showing log capture when `--ll` is passed

zombie_lord_infinite
Tyler Goodlet 2021-10-11 21:53:54 -04:00
parent 4d30e25591
commit 5eb7c4c857
1 changed files with 9 additions and 1 deletions

View File

@ -74,7 +74,15 @@ def pytest_configure(config):
@pytest.fixture(scope='session', autouse=True)
def loglevel(request):
orig = tractor.log._default_loglevel
level = tractor.log._default_loglevel = request.config.option.loglevel
level_from_cli = request.config.option.loglevel
# disable built-in capture when user passes the `--ll` value
# presuming they already know they want to see console logging
# and don't need it repeated by pytest.
if level_from_cli:
request.config.option.showcapture = 'no'
level = tractor.log._default_loglevel = level_from_cli
yield level
tractor.log._default_loglevel = orig