test(shared): fix linting
This commit is contained in:
parent
1a1f0488d5
commit
b9502bc203
|
@ -64,18 +64,18 @@ def setup_logger(
|
||||||
:param serialize: generate JSON formatted log records
|
:param serialize: generate JSON formatted log records
|
||||||
:returns: log level guessed from the verbosity
|
: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:
|
if filepath is not None:
|
||||||
handlers.append(
|
handlers.append(
|
||||||
dict(
|
{
|
||||||
sink=filepath,
|
"sink": filepath,
|
||||||
enqueue=True,
|
"enqueue": True,
|
||||||
level=level.no,
|
"level": level.no,
|
||||||
serialize=serialize,
|
"serialize": serialize,
|
||||||
rotation="12:00",
|
"rotation": "12:00",
|
||||||
retention="7 days",
|
"retention": "7 days",
|
||||||
)
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.configure(handlers=handlers)
|
logger.configure(handlers=handlers)
|
||||||
|
@ -101,14 +101,14 @@ def create_task_logger(
|
||||||
|
|
||||||
task_logger.configure(
|
task_logger.configure(
|
||||||
handlers=[
|
handlers=[
|
||||||
dict(
|
{
|
||||||
sink=filepath,
|
"sink": filepath,
|
||||||
enqueue=True,
|
"enqueue": True,
|
||||||
level=level.no,
|
"level": level.no,
|
||||||
serialize=serialize,
|
"serialize": serialize,
|
||||||
rotation="12:00",
|
"rotation": "12:00",
|
||||||
retention="7 days",
|
"retention": "7 days",
|
||||||
)
|
}
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,13 @@ def test_base_config(tmp_path: Path):
|
||||||
|
|
||||||
with mock.patch.dict(
|
with mock.patch.dict(
|
||||||
environ,
|
environ,
|
||||||
dict(
|
{
|
||||||
LIBRETIME_API="invalid",
|
"LIBRETIME_API": "invalid",
|
||||||
LIBRETIME_DATABASE="invalid",
|
"LIBRETIME_DATABASE": "invalid",
|
||||||
LIBRETIME_DATABASE_PORT="8888",
|
"LIBRETIME_DATABASE_PORT": "8888",
|
||||||
LIBRETIME_RABBITMQ_HOST="changed",
|
"LIBRETIME_RABBITMQ_HOST": "changed",
|
||||||
WRONGPREFIX_API_KEY="invalid",
|
"WRONGPREFIX_API_KEY": "invalid",
|
||||||
),
|
},
|
||||||
):
|
):
|
||||||
config = FixtureConfig(filepath=config_filepath)
|
config = FixtureConfig(filepath=config_filepath)
|
||||||
|
|
||||||
|
@ -49,13 +49,13 @@ def test_base_config(tmp_path: Path):
|
||||||
assert config.rabbitmq.port == 5672
|
assert config.rabbitmq.port == 5672
|
||||||
|
|
||||||
# Optional model: loading default values (rabbitmq)
|
# Optional model: loading default values (rabbitmq)
|
||||||
with mock.patch.dict(environ, dict()):
|
with mock.patch.dict(environ, {}):
|
||||||
config = FixtureConfig(filepath=config_filepath)
|
config = FixtureConfig(filepath=config_filepath)
|
||||||
assert config.rabbitmq.host == "localhost"
|
assert config.rabbitmq.host == "localhost"
|
||||||
assert config.rabbitmq.port == 5672
|
assert config.rabbitmq.port == 5672
|
||||||
|
|
||||||
# Optional model: overriding using environment (rabbitmq)
|
# 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)
|
config = FixtureConfig(filepath=config_filepath)
|
||||||
assert config.rabbitmq.host == "changed"
|
assert config.rabbitmq.host == "changed"
|
||||||
assert config.rabbitmq.port == 5672
|
assert config.rabbitmq.port == 5672
|
||||||
|
@ -74,7 +74,7 @@ def test_base_config_ini(tmp_path: Path):
|
||||||
|
|
||||||
with mock.patch.dict(
|
with mock.patch.dict(
|
||||||
environ,
|
environ,
|
||||||
dict(LIBRETIME_API_KEY="f3bf04fc"),
|
{"LIBRETIME_API_KEY": "f3bf04fc"},
|
||||||
):
|
):
|
||||||
config = FixtureConfig(filepath=config_filepath)
|
config = FixtureConfig(filepath=config_filepath)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue