File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
packages/settings-library/tests Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1515from pydantic_settings import BaseSettings
1616from pytest_mock import MockerFixture
1717from pytest_simcore .helpers .monkeypatch_envs import setenvs_from_envfile
18+ from pytest_simcore .helpers .typing_env import EnvVarsDict
1819from 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
2427S2 = json .dumps ({"S_VALUE" : 2 })
2528S3 = 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
You can’t perform that action at this time.
0 commit comments