test(shared): fix linting

This commit is contained in:
jo 2022-01-25 15:41:45 +01:00 committed by Kyle Robbertze
parent 1a1f0488d5
commit b9502bc203
2 changed files with 27 additions and 27 deletions

View File

@ -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",
}
],
)

View File

@ -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)