Skip to content

Commit 1e79acc

Browse files
authored
Update to Pydantic 2.0.1 (#101)
1 parent 3f613ae commit 1e79acc

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ classifiers = [
4040
]
4141
requires-python = '>=3.7'
4242
dependencies = [
43-
'pydantic>=2.0',
43+
'pydantic>=2.0.1',
4444
'python-dotenv>=0.21.0',
4545
]
4646
dynamic = ['version']

requirements/pyproject.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#
77
annotated-types==0.4.0
88
# via pydantic
9-
pydantic==2.0
9+
pydantic==2.0.1
1010
# via pydantic-settings (pyproject.toml)
11-
pydantic-core==2.0.1
11+
pydantic-core==2.0.2
1212
# via pydantic
1313
python-dotenv==0.21.1
1414
# via pydantic-settings (pyproject.toml)

tests/test_settings.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,19 +1620,31 @@ class Settings(BaseSettings):
16201620

16211621
def test_protected_namespace_defaults():
16221622
# pydantic default
1623-
with pytest.raises(NameError, match='Field "model_prefixed_field" has conflict with protected namespace "model_"'):
1623+
with pytest.warns(UserWarning, match='Field "model_prefixed_field" has conflict with protected namespace "model_"'):
16241624

16251625
class Model(BaseSettings):
16261626
model_prefixed_field: str
16271627

16281628
# pydantic-settings default
16291629
with pytest.raises(
1630-
NameError, match='Field "settings_prefixed_field" has conflict with protected namespace "settings_"'
1630+
UserWarning, match='Field "settings_prefixed_field" has conflict with protected namespace "settings_"'
16311631
):
16321632

16331633
class Model1(BaseSettings):
16341634
settings_prefixed_field: str
16351635

1636+
with pytest.raises(
1637+
NameError,
1638+
match=(
1639+
'Field "settings_customise_sources" conflicts with member <bound method '
1640+
"BaseSettings.settings_customise_sources of <class 'pydantic_settings.main.BaseSettings'>> "
1641+
'of protected namespace "settings_".'
1642+
),
1643+
):
1644+
1645+
class Model2(BaseSettings):
1646+
settings_customise_sources: str
1647+
16361648

16371649
def test_case_sensitive_from_args(monkeypatch):
16381650
class Settings(BaseSettings):

0 commit comments

Comments
 (0)