Commit 8e9f5639 authored by Štěpán Balážik's avatar Štěpán Balážik

logging: exits if both verbose logging and xdist are on

parent 839af390
Pipeline #43135 passed with stage
in 2 minutes and 19 seconds
from collections import namedtuple, OrderedDict
import glob
import logging
import os
import re
import yaml
import pytest
Scenario = namedtuple("Scenario", ["path", "qmin", "config"])
......@@ -125,3 +128,22 @@ def pytest_generate_tests(metafunc):
if 'rpl_path' in metafunc.fixturenames:
paths = metafunc.config.option.scenarios
metafunc.parametrize("rpl_path", rpls(paths), ids=str)
def check_log_level_xdist(level):
if level < logging.ERROR:
pytest.exit("Advanced logging not available while running with xdist "
"(try ommiting -n option)")
def pytest_configure(config):
# This means pytest-xdist is installed and enabled
if hasattr(config.option, "dist") and config.option.dist == "load":
log_level = config.option.log_level
if log_level is None:
log_level = int(log_level)
except ValueError:
log_level = logging.getLevelName(log_level)
......@@ -3,4 +3,5 @@ log_print = true
......@@ -9,4 +9,4 @@ source "${MAKEDIR}/"
# compatibility with old TESTS= env variable
# add --scenarios= only if the variable TESTS is non-empty
python3 -m pytest -c "${MAKEDIR}/deckard_pytest.ini" --tb=short -q ${VERBOSE:-"--log-level=40"} ${VERBOSE:+"--log-level=10"} "${MAKEDIR}" ${DECKARDFLAGS:-} ${TESTS:+"--scenarios=${TESTS}"} "$@"
python3 -m pytest -c "${MAKEDIR}/deckard_pytest.ini" --tb=short -q ${VERBOSE:+"--log-level=DEBUG"} "${MAKEDIR}" ${DECKARDFLAGS:-} ${TESTS:+"--scenarios=${TESTS}"} "$@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment