1
0
python-pydantic-settings/clear-environment.patch
Steve Kowalik 32b68a6f83 - Update to 2.4.0:
* Fix regex flags accidentally passed as count
  * Deprecate read_env_file and move it to DotEnvSettingsSource
  * Fix a bug when loading empty yaml file
  * feat: Enable access to the current state in settings sources
  * Add support for short options
  * Add Azure Key Vault settings source
  * Add cli_exit_on_error config option

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic-settings?expand=0&rev=7
2024-09-10 04:58:20 +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