python-pydantic-settings/clear-environment.patch
Steve Kowalik e4a8a0d837 - Update to 2.7.1:
* Move preferred alias resolution to private method
  * Fix test_protected_namespace_defaults with -Wdefault
  * Make tests more robust to the running environment
  * Fix rendering of annotations in code example
  * Fix alias resolution for default settings source.
  * Use the class name in the __repr__ implementations
  * Fix default help text for union of submodels.
  * Add support for CliMutuallyExclusiveGroup.
  * Disable abbreviations on internal parser.
  * Fix Secret field parsing
  * Fix alias resolution to use preferred key.
  * Strip annotated when getting submodels during CLI parsing.
  * Removing return type from the function in test
  * Relax default protected_namespaces
  * Add support for CLI kebab case flag.
  * Change reference of default values validation in documentation
  * Improve field value parsing by adding NoDecode and ForceDecode
    annotations
  * Fix attribute error on Python 3.9 with typing.Sequence
  * Add Python 3.13 support
  * Adding support for populate_by_name
  * Refactor path_type_label
  * Fix nested model field with alias parsing
  * Fix PathType typing in case of sequence
  * Add cli_ignore_unknown_args config option.
  * Fix AzureKeyVaultSettingsSource problem in case of field with underscore
  * Add cli_flag_prefix_char config option.
  * Fix nested model AliasChoices in validation alias
  * Add CLI App Support

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic-settings?expand=0&rev=12
2025-01-28 02:23:18 +00:00

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