Accepting request 1137356 from devel:languages:python

- update to 1.10.13:
  * Fix: Add max length check to `pydantic.validate_email`
  * Docs: Fix pip commands to install v1
  * Fixes the `maxlen` property being dropped on `deque`
    validation. Happened only if the deque item has been typed.
    Changes the `_validate_sequence_like` func, #6581 by
  * Importing create_model in tools.py through relative path
    instead of absolute path - so that it doesn't import V2 code
    when copied over to V2 branch, #6361 by @SharathHuddar
  * Add Pydantic `Json` field support to settings management,
  * Fixed literal validator errors for unhashable values
  * Fixed bug with generics receiving forward refs
  * Update install method of FastAPI for internal tests in CI,
    #6117 by @Kludex
- add Fix-Python-3.12-test-failures.patch: fix test fails with
  Python 3.12

  * Use packaging, not pkg_resources for versions.
- Skip some truculent tests.
  * Security fix: Fix date and datetime parsing so passing either 'infinity'
  * BaseSettings now uses the special env settings to define which
  * Change the precedence of aliases so child model aliases override
  * Add support for required Optional with name: Optional[AnyType] = Field(...)
  * alias precedence logic changed so aliases on a field always take

OBS-URL: https://build.opensuse.org/request/show/1137356
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic?expand=0&rev=20
This commit is contained in:
Dominique Leuenberger 2024-01-07 20:38:56 +00:00 committed by Git OBS Bridge
commit 2ce2973d16
5 changed files with 111 additions and 12 deletions

View File

@ -0,0 +1,78 @@
From 5fd4002c62d3538efc3ff51f92850f4c0bf4ffab Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell@gtmx.me>
Date: Sat, 12 Aug 2023 00:21:50 +0000
Subject: [PATCH] Fix Python 3.12 test failures
---
tests/test_abc.py | 15 ++++++++++++---
tests/test_generics.py | 6 ++++--
tests/test_types.py | 6 +++++-
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/tests/test_abc.py b/tests/test_abc.py
index 8beed04..d7e8f3d 100644
--- a/tests/test_abc.py
+++ b/tests/test_abc.py
@@ -1,4 +1,5 @@
import abc
+import sys
import pytest
@@ -40,7 +41,15 @@ def test_model_subclassing_abstract_base_classes_without_implementation_raises_e
with pytest.raises(TypeError) as excinfo:
Model(some_field='some_value')
- assert str(excinfo.value) == (
- "Can't instantiate abstract class Model with abstract methods "
- "my_abstract_classmethod, my_abstract_method, my_abstract_property, my_abstract_staticmethod" # noqa: Q000
+ message = (
+ (
+ "Can't instantiate abstract class Model with abstract methods "
+ "my_abstract_classmethod, my_abstract_method, my_abstract_property, my_abstract_staticmethod" # noqa: Q000
+ )
+ if sys.version_info < (3, 12)
+ else (
+ "Can't instantiate abstract class Model without an implementation for abstract methods "
+ "'my_abstract_classmethod', 'my_abstract_method', 'my_abstract_property', 'my_abstract_staticmethod'" # noqa: Q000
+ )
)
+ assert str(excinfo.value) == message
diff --git a/tests/test_generics.py b/tests/test_generics.py
index 68f93d4..23e6263 100644
--- a/tests/test_generics.py
+++ b/tests/test_generics.py
@@ -579,9 +579,11 @@ def test_partial_specification_name():
b: BT
partial_model = Model[int, BT]
- assert partial_model.__name__ == 'Model[int, BT]'
+ expected = 'Model[int, BT]' if sys.version_info < (3, 12) else 'Model[int, TypeVar]'
+ assert partial_model.__name__ == expected
concrete_model = partial_model[str]
- assert concrete_model.__name__ == 'Model[int, BT][str]'
+ expected += '[str]'
+ assert concrete_model.__name__ == expected
def test_partial_specification_instantiation():
diff --git a/tests/test_types.py b/tests/test_types.py
index b908d46..4277398 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -2713,7 +2713,11 @@ def test_secretfield():
class Foobar(SecretField):
...
- message = "Can't instantiate abstract class Foobar with abstract methods? get_secret_value"
+ message = (
+ "Can't instantiate abstract class Foobar with abstract methods? get_secret_value"
+ if sys.version_info < (3, 12)
+ else "Can't instantiate abstract class Foobar without an implementation for abstract method 'get_secret_value'"
+ )
with pytest.raises(TypeError, match=message):
Foobar()
--
2.41.0

3
pydantic-1.10.13.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:be1cbc321d34dc1dcca2525f6627a7bbdd879adfe5dbcb43c4ca6d983bd50a42
size 766572

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:147a6e94420b81d75be7ce63efc64d6cbf8e297ef27d6fc38cd4f542d955687f
size 765868

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Thu Nov 16 09:58:50 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 1.10.13:
* Fix: Add max length check to `pydantic.validate_email`
* Docs: Fix pip commands to install v1
* Fixes the `maxlen` property being dropped on `deque`
validation. Happened only if the deque item has been typed.
Changes the `_validate_sequence_like` func, #6581 by
* Importing create_model in tools.py through relative path
instead of absolute path - so that it doesn't import V2 code
when copied over to V2 branch, #6361 by @SharathHuddar
* Add Pydantic `Json` field support to settings management,
* Fixed literal validator errors for unhashable values
* Fixed bug with generics receiving forward refs
* Update install method of FastAPI for internal tests in CI,
#6117 by @Kludex
- add Fix-Python-3.12-test-failures.patch: fix test fails with
Python 3.12
-------------------------------------------------------------------
Wed Jul 5 13:07:17 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pydantic
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2019, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
@ -19,7 +19,7 @@
%{?sle15_python_module_pythons}
Name: python-pydantic
Version: 1.10.9
Version: 1.10.13
Release: 0
Summary: Data validation and settings management using python type hinting
License: MIT
@ -28,6 +28,7 @@ Source: https://github.com/pydantic/pydantic/archive/v%{version}.tar.gz#
# PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed
# (Pulled in by email-validator)
Patch0: ignore-urllib3-pyopenssl-warning.patch
Patch1: Fix-Python-3.12-test-failures.patch
BuildRequires: %{python_module email-validator >= 1.0.3}
BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pytest-mock}