forked from pool/python-pydantic-settings
Dirk Mueller
ffb9010f83
* add in-place reloading in docs * Nested pydantic dataclasses and doc fixes. * Remove leftover docstring causing warning on `pydantic` docs build - update to 2.3.3: * Fix an intriduced bug in parsing json field with discriminated union * Add CliSettingsSource alias handling for AliasChoices and AliasPath. - update to 2.3.2: * Initialize CLI source on demand. * Fix command line help from `argparse` formatting problem * Fix issue with nested model uppercase field name in case insensitive mode - update to 2.3.1: * Fix a regression in parsing env value for nested dict - update to 2.3.0: * Add environment parsing support for enums. * Improve `explode_env_vars` for better dict handling * add `PyprojectTomlConfigSettingsSource` * Fix broken link in AliasChoices class * Update Pydantic * fix: superfluous deep env conflicts with non-dict model leaf * fix: a second level of environment nesting expected a dict * Fix an issue when inner types of a discriminated union with a callable discriminator were not correctly identified as complex. * Fix a bug when we have case insentive field in nested model * Add CLI Settings Source OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic-settings?expand=0&rev=5
33 lines
1.2 KiB
Diff
33 lines
1.2 KiB
Diff
Index: pydantic_settings-2.3.4/tests/test_settings.py
|
|
===================================================================
|
|
--- pydantic_settings-2.3.4.orig/tests/test_settings.py
|
|
+++ pydantic_settings-2.3.4/tests/test_settings.py
|
|
@@ -10,6 +10,7 @@ from datetime import datetime, timezone
|
|
from enum import IntEnum
|
|
from pathlib import Path
|
|
from typing import Any, Callable, Dict, Generic, Hashable, List, Optional, Set, Tuple, Type, TypeVar, Union
|
|
+from unittest import mock
|
|
|
|
import pytest
|
|
import typing_extensions
|
|
@@ -1116,7 +1117,8 @@ def test_multiple_env_file(tmp_path):
|
|
|
|
model_config = SettingsConfigDict(env_file=[base_env, prod_env])
|
|
|
|
- s = Settings()
|
|
+ with mock.patch.dict('os.environ', {}, clear=True):
|
|
+ s = Settings()
|
|
assert s.debug_mode is False
|
|
assert s.host == 'https://example.com/services'
|
|
assert s.port == 8000
|
|
@@ -1135,7 +1137,8 @@ def test_model_env_file_override_model_c
|
|
|
|
model_config = SettingsConfigDict(env_file=prod_env)
|
|
|
|
- s = Settings(_env_file=base_env)
|
|
+ with mock.patch.dict('os.environ', {}, clear=True):
|
|
+ s = Settings(_env_file=base_env)
|
|
assert s.debug_mode is True
|
|
assert s.host == 'localhost'
|
|
assert s.port == 8000
|