summaryrefslogtreecommitdiff
path: root/tests/unit/utils/test_log.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/utils/test_log.py')
-rw-r--r--tests/unit/utils/test_log.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/utils/test_log.py b/tests/unit/utils/test_log.py
index a74d81600..45543a136 100644
--- a/tests/unit/utils/test_log.py
+++ b/tests/unit/utils/test_log.py
@@ -255,6 +255,30 @@ class TestInitLog:
warnings.warn("test warning", PendingDeprecationWarning)
+@pytest.mark.parametrize(
+ 'console_cli,console_conf,console_expected,ram_conf,ram_expected',
+ [
+ (None, None, logging.INFO, None, logging.NOTSET),
+ (None, None, logging.INFO, 'CRITICAL', logging.CRITICAL),
+ (None, 'WARNING', logging.WARNING, 'INFO', logging.INFO),
+ ('INFO', 'WARNING', logging.INFO, 'VDEBUG', logging.VDEBUG),
+ ('WARNING', 'INFO', logging.WARNING, 'CRITICAL', logging.CRITICAL),
+ ])
+def test_init_from_config(mocker, console_cli, console_conf, console_expected,
+ ram_conf, ram_expected):
+ args = argparse.Namespace(debug=False, loglevel=console_cli, color=True,
+ loglines=10, logfilter="", force_color=False,
+ json_logging=False, debug_flags=set())
+ log.init_log(args)
+
+ conf = mocker.Mock()
+ conf.logging.level.ram = ram_conf
+ conf.logging.level.console = console_conf
+ log.init_from_config(conf)
+ assert log.ram_handler.level == ram_expected
+ assert log.console_handler.level == console_expected
+
+
class TestHideQtWarning:
"""Tests for hide_qt_warning/QtWarningFilter."""