From b9502bc20353c1733e01dede5bf4cd1637492140 Mon Sep 17 00:00:00 2001 From: jo Date: Tue, 25 Jan 2022 15:41:45 +0100 Subject: [PATCH] test(shared): fix linting --- shared/libretime_shared/logging.py | 34 +++++++++++++++--------------- shared/tests/config_test.py | 20 +++++++++--------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/shared/libretime_shared/logging.py b/shared/libretime_shared/logging.py index 0c1366014..aa43a141d 100644 --- a/shared/libretime_shared/logging.py +++ b/shared/libretime_shared/logging.py @@ -64,18 +64,18 @@ def setup_logger( :param serialize: generate JSON formatted log records :returns: log level guessed from the verbosity """ - handlers = [dict(sink=sys.stderr, level=level.no, serialize=serialize)] + handlers = [{"sink": sys.stderr, "level": level.no, "serialize": serialize}] if filepath is not None: handlers.append( - dict( - sink=filepath, - enqueue=True, - level=level.no, - serialize=serialize, - rotation="12:00", - retention="7 days", - ) + { + "sink": filepath, + "enqueue": True, + "level": level.no, + "serialize": serialize, + "rotation": "12:00", + "retention": "7 days", + } ) logger.configure(handlers=handlers) @@ -101,14 +101,14 @@ def create_task_logger( task_logger.configure( handlers=[ - dict( - sink=filepath, - enqueue=True, - level=level.no, - serialize=serialize, - rotation="12:00", - retention="7 days", - ) + { + "sink": filepath, + "enqueue": True, + "level": level.no, + "serialize": serialize, + "rotation": "12:00", + "retention": "7 days", + } ], ) diff --git a/shared/tests/config_test.py b/shared/tests/config_test.py index a21cfb4e5..01ba68ee5 100644 --- a/shared/tests/config_test.py +++ b/shared/tests/config_test.py @@ -32,13 +32,13 @@ def test_base_config(tmp_path: Path): with mock.patch.dict( environ, - dict( - LIBRETIME_API="invalid", - LIBRETIME_DATABASE="invalid", - LIBRETIME_DATABASE_PORT="8888", - LIBRETIME_RABBITMQ_HOST="changed", - WRONGPREFIX_API_KEY="invalid", - ), + { + "LIBRETIME_API": "invalid", + "LIBRETIME_DATABASE": "invalid", + "LIBRETIME_DATABASE_PORT": "8888", + "LIBRETIME_RABBITMQ_HOST": "changed", + "WRONGPREFIX_API_KEY": "invalid", + }, ): config = FixtureConfig(filepath=config_filepath) @@ -49,13 +49,13 @@ def test_base_config(tmp_path: Path): assert config.rabbitmq.port == 5672 # Optional model: loading default values (rabbitmq) - with mock.patch.dict(environ, dict()): + with mock.patch.dict(environ, {}): config = FixtureConfig(filepath=config_filepath) assert config.rabbitmq.host == "localhost" assert config.rabbitmq.port == 5672 # Optional model: overriding using environment (rabbitmq) - with mock.patch.dict(environ, dict(LIBRETIME_RABBITMQ_HOST="changed")): + with mock.patch.dict(environ, {"LIBRETIME_RABBITMQ_HOST": "changed"}): config = FixtureConfig(filepath=config_filepath) assert config.rabbitmq.host == "changed" assert config.rabbitmq.port == 5672 @@ -74,7 +74,7 @@ def test_base_config_ini(tmp_path: Path): with mock.patch.dict( environ, - dict(LIBRETIME_API_KEY="f3bf04fc"), + {"LIBRETIME_API_KEY": "f3bf04fc"}, ): config = FixtureConfig(filepath=config_filepath)