mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Add a custom --yunodebug option for pytest (#303)
This commit is contained in:
parent
0e44a42274
commit
785790b930
1 changed files with 9 additions and 4 deletions
|
@ -3,6 +3,10 @@ import moulinette
|
||||||
|
|
||||||
sys.path.append("..")
|
sys.path.append("..")
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_addoption(parser):
|
||||||
|
parser.addoption("--yunodebug", action="store_true", default=False)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Tweak moulinette init to have yunohost namespace #
|
# Tweak moulinette init to have yunohost namespace #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -39,7 +43,7 @@ moulinette.core.Moulinette18n.n = new_m18nn
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
def _init_moulinette():
|
def pytest_cmdline_main(config):
|
||||||
"""Configure logging and initialize the moulinette"""
|
"""Configure logging and initialize the moulinette"""
|
||||||
# Define loggers handlers
|
# Define loggers handlers
|
||||||
handlers = set(['tty'])
|
handlers = set(['tty'])
|
||||||
|
@ -47,6 +51,9 @@ def _init_moulinette():
|
||||||
|
|
||||||
# Define loggers level
|
# Define loggers level
|
||||||
level = 'INFO'
|
level = 'INFO'
|
||||||
|
if config.option.yunodebug:
|
||||||
|
tty_level = 'DEBUG'
|
||||||
|
else:
|
||||||
tty_level = 'SUCCESS'
|
tty_level = 'SUCCESS'
|
||||||
|
|
||||||
# Custom logging configuration
|
# Custom logging configuration
|
||||||
|
@ -99,5 +106,3 @@ def _init_moulinette():
|
||||||
# Initialize moulinette
|
# Initialize moulinette
|
||||||
moulinette.init(logging_config=logging, _from_source=False)
|
moulinette.init(logging_config=logging, _from_source=False)
|
||||||
|
|
||||||
|
|
||||||
_init_moulinette()
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue