test: add support for custom radicale loglevel
This commit is contained in:
@@ -42,8 +42,18 @@ from radicale import app, config, types, utils, xmlutils
|
|||||||
|
|
||||||
RESPONSES = Dict[str, Union[int, Dict[str, Tuple[int, ET.Element]], vobject.base.Component]]
|
RESPONSES = Dict[str, Union[int, Dict[str, Tuple[int, ET.Element]], vobject.base.Component]]
|
||||||
|
|
||||||
# Enable debug output
|
if 'PYTEST_RADICALE_LOGLEVEL' in os.environ:
|
||||||
radicale.log.logger.setLevel(logging.DEBUG)
|
# Set custom loglevel
|
||||||
|
level = os.environ["PYTEST_RADICALE_LOGLEVEL"]
|
||||||
|
logging.info("Setting loglevel by environment (PYTEST_RADICALE_LOGLEVEL): %s", level)
|
||||||
|
else:
|
||||||
|
# Default level
|
||||||
|
level = "debug"
|
||||||
|
logging.info("Setting loglevel by default: %s", level)
|
||||||
|
if isinstance(level, str):
|
||||||
|
level = getattr(logging, level.upper())
|
||||||
|
assert isinstance(level, int)
|
||||||
|
radicale.log.logger.setLevel(level)
|
||||||
|
|
||||||
|
|
||||||
class BaseTest:
|
class BaseTest:
|
||||||
|
|||||||
Reference in New Issue
Block a user