forked from pool/python-pydantic-settings
16dba026f5
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic-settings?expand=0&rev=1
33 lines
1.2 KiB
Diff
33 lines
1.2 KiB
Diff
Index: pydantic_settings-2.2.1/tests/test_settings.py
|
|
===================================================================
|
|
--- pydantic_settings-2.2.1.orig/tests/test_settings.py
|
|
+++ pydantic_settings-2.2.1/tests/test_settings.py
|
|
@@ -6,6 +6,7 @@ import uuid
|
|
from datetime import datetime, timezone
|
|
from pathlib import Path
|
|
from typing import Any, Callable, Dict, Generic, List, Optional, Set, Tuple, Type, TypeVar, Union
|
|
+from unittest import mock
|
|
|
|
import pytest
|
|
from annotated_types import MinLen
|
|
@@ -1050,7 +1051,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
|
|
@@ -1069,7 +1071,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
|