Skip to content

Commit a2ae61b

Browse files
committed
settings-library
1 parent 0b5e311 commit a2ae61b

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
from typing import Annotated
2+
13
from pydantic import Field
24

35
from .base import BaseCustomSettings
46
from .s3 import S3Settings
57

68

79
class AwsS3CliSettings(BaseCustomSettings):
8-
AWS_S3_CLI_S3: S3Settings = Field(
9-
default=None,
10-
description="These settings intentionally do not use auto_default_from_env=True because we might want to turn them off if RClone is enabled.",
11-
)
10+
AWS_S3_CLI_S3: Annotated[
11+
S3Settings,
12+
Field(
13+
description="These settings intentionally do not use auto_default_from_env=True "
14+
"because we might want to turn them off if RClone is enabled.",
15+
),
16+
]

packages/settings-library/src/settings_library/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def prepare_field_value(
9191
and field.default is None
9292
and prepared_value == _MARKED_AS_UNSET
9393
):
94-
prepared_value = field.default_factory()
94+
prepared_value = field.default_factory() # type: ignore[call-arg]
9595
return prepared_value
9696

9797

packages/settings-library/tests/test_base_w_postgres.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
from collections.abc import Callable
88

99
import pytest
10-
from pydantic import AliasChoices, Field, ValidationError
10+
from pydantic import AliasChoices, Field, ValidationError, __version__
1111
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_envfile
1212
from settings_library.base import BaseCustomSettings, DefaultFromEnvFactoryError
1313
from settings_library.basic_types import PortInt
1414

15+
pydantic_vtag = ".".join(__version__.split(".")[:2])
16+
17+
1518
#
1619
# NOTE: Pydantic models are returned by function-scoped fixture such that every
1720
# test starts with a fresh Model class (notice that pydanctic classes involve meta-operations
@@ -174,7 +177,7 @@ def test_parse_from_individual_envs(
174177
"loc": ("WEBSERVER_POSTGRES",),
175178
"msg": "Field required",
176179
"type": "missing",
177-
"url": "https://errors.pydantic.dev/2.9/v/missing",
180+
"url": f"https://errors.pydantic.dev/{pydantic_vtag}/v/missing",
178181
}
179182

180183
s2 = S2()

0 commit comments

Comments
 (0)