Skip to content

Commit 1b1abe6

Browse files
committed
test
1 parent f63b59b commit 1b1abe6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/settings-library/tests/test_base.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
from pydantic_settings import BaseSettings
1616
from pytest_mock import MockerFixture
1717
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_envfile
18+
from pytest_simcore.helpers.typing_env import EnvVarsDict
1819
from settings_library.base import (
1920
_DEFAULTS_TO_NONE_MSG,
2021
BaseCustomSettings,
2122
DefaultFromEnvFactoryError,
2223
)
24+
from settings_library.email import SMTPSettings
25+
from settings_library.utils_logging import MixinLoggingSettings
2326

2427
S2 = json.dumps({"S_VALUE": 2})
2528
S3 = json.dumps({"S_VALUE": 3})
@@ -336,3 +339,15 @@ class SettingsClassThatFailed(BaseCustomSettings):
336339

337340
SettingsClassThatFailed(FOO={})
338341
assert SettingsClassThatFailed(FOO=None) == SettingsClassThatFailed()
342+
343+
344+
def test_upgrade_failure_to_pydantic_settings_2_6(
345+
mock_env_devel_environment: EnvVarsDict,
346+
):
347+
class ProblematicSettings(BaseCustomSettings, MixinLoggingSettings):
348+
WEBSERVER_EMAIL: SMTPSettings | None = Field(
349+
json_schema_extra={"auto_default_from_env": True}
350+
)
351+
352+
settings = ProblematicSettings.create_from_envs()
353+
assert settings.WEBSERVER_EMAIL is not None

0 commit comments

Comments
 (0)