diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..fcc7b97
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ test
+
diff --git a/ignore-urllib3-pyopenssl-warning.patch b/ignore-urllib3-pyopenssl-warning.patch
deleted file mode 100644
index 02899b9..0000000
--- a/ignore-urllib3-pyopenssl-warning.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: pydantic-1.10.2/setup.cfg
-===================================================================
---- pydantic-1.10.2.orig/setup.cfg
-+++ pydantic-1.10.2/setup.cfg
-@@ -11,6 +11,7 @@ filterwarnings =
- # for Python 3.11
- ignore:path is deprecated.*:DeprecationWarning:certifi
- ignore:module 'sre_constants' is deprecated:DeprecationWarning:pkg_resources
-+ ignore:.*urllib3.contrib.pyopenssl.*:DeprecationWarning
-
- [flake8]
- max-line-length = 120
diff --git a/pydantic-1.10.7.tar.gz b/pydantic-1.10.7.tar.gz
deleted file mode 100644
index 7cc1d2e..0000000
--- a/pydantic-1.10.7.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ff346da03d333b055a2d432f50e2b5c452697a2881d6ff2302162d2525c7f145
-size 903379
diff --git a/pydantic-2.7.3.tar.gz b/pydantic-2.7.3.tar.gz
new file mode 100644
index 0000000..7578e01
--- /dev/null
+++ b/pydantic-2.7.3.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c2706033be7d026c2a2d7ccf512d67c41e32d17d1d40cbc4a5bd57578d3d70cc
+size 2749431
diff --git a/python-pydantic.changes b/python-pydantic.changes
index cc75e2a..305ee40 100644
--- a/python-pydantic.changes
+++ b/python-pydantic.changes
@@ -1,3 +1,264 @@
+-------------------------------------------------------------------
+Thu Jun 6 14:14:46 UTC 2024 - Dirk Müller
+
+- update to 2.7.3:
+ * Bump `pydantic-core` to `v2.18.4`
+ * Fix u style unicode strings in python @samuelcolvin in
+ pydantic/jiter#110
+ * Replace `__spec__.parent` with `__package__`
+ * Fix validation of `int`s with leading unary minus
+ * Fix `str` subclass validation for enums
+ * Support `BigInt`s in `Literal`s and `Enum`s
+ * Fix: uuid - allow `str` subclass as input
+
+-------------------------------------------------------------------
+Thu May 30 04:56:19 UTC 2024 - Steve Kowalik
+
+- Add patch support-pytest-8.patch:
+ * Support changes in pytest 8.x.
+
+-------------------------------------------------------------------
+Sat Apr 27 07:45:31 UTC 2024 - Dirk Müller
+
+- update to 2.7.1:
+ * Bump `pydantic-core` to `v2.18.2`
+ * Ftp and Websocket connection strings support
+ * Use field description for RootModel schema description when
+ there is `…`
+ * Fix `validation_alias` behavior with `model_construct` for
+ `AliasChoices` and `AliasPath`
+ * Revert `typing.Literal` and import it outside the
+ TYPE_CHECKING block
+ * Fix `Secret` serialization schema, applicable for unions
+ * Fix `strict` application to `function-after` with
+ `use_enum_values`
+ * Address case where `model_construct` on a class which defines
+ `model_post_init` fails with `AttributeError`
+ * Fix `model_json_schema` with config types
+ * Support multiple zeros as an `int`
+ * Fix validation of `int`s with leading unary plus
+ * Fix interaction between `extra != 'ignore'` and
+ `from_attributes=True`
+ * Handle error from `Enum`'s `missing` function as
+ `ValidationError`
+ * Fix memory leak with `Iterable` validation
+ * Adopt `jiter` `v0.2.0`
+ * Extract attribute docstrings from `FieldInfo.description`
+ * Add a `with_config` decorator to comply with typing spec
+ * Allow an optional separator splitting the value and unit of
+ the result of `ByteSize.human_readable`
+ * Add generic `Secret` base type
+ * Make use of `Sphinx` inventories for cross references in docs
+ * Add environment variable to disable plugins
+ * Add support for `deprecated` fields
+ * Allow `field_serializer('*')`
+ * Handle a case when `model_config` is defined as a model
+ property
+ * Update `create_model()` to support `typing.Annotated` as
+ input
+ * Add `ClickhouseDsn` support
+ * Add support for `re.Pattern[str]` to `pattern` field
+ * Support for `serialize_as_any` runtime setting
+ * Add support for `typing.Self`
+ * Ability to pass `context` to serialization
+ * Add feedback widget to docs with flarelytics integration
+ * Support for parsing partial JSON strings in Python
+ * Add support for field level number to str coercion option
+ * Update `warnings` parameter for serialization utilities to
+ allow raising a warning
+
+-------------------------------------------------------------------
+Sat Mar 16 11:56:01 UTC 2024 - Dirk Müller
+
+- update to 2.6.4:
+ * Fix usage of `AliasGenerator` with `computed_field` decorator
+ * Fix nested discriminated union schema gen, pt 2
+ * Fix bug with no_strict_optional=True caused by API deferral
+
+-------------------------------------------------------------------
+Thu Mar 7 03:28:00 UTC 2024 - Steve Kowalik
+
+- Update to 2.6.3 (bsc#1222806, CVE-2024-3772):
+ * Fix inheriting `Field` annotations in dataclasses
+ * Fix warning for tuple of wrong size in `Union`
+ * Fix `computed_field` JSON serializer `exclude_none` behavior
+ * Check for `email-validator` version >= 2.0
+ * Add `NatsDsn`
+ * Add `ConfigDict.ser_json_inf_nan`
+ * Support `AliasGenerator` usage
+ * Support `yyyy-MM-DD` datetime parsing
+ * Added bits conversions to the `ByteSize` class
+ * Add `eval_type_backport` to handle union operator
+ * Add support for `dataclass` fields `init`
+ * Implement pickling for `ValidationError`
+ * Add unified tuple validator that can handle "variadic" tuples via PEP-646
+ * Drop Python3.7 support
+ * Make `@validate_call` return a function instead of a custom descriptor
+ * Introducing `classproperty` decorator for `model_computed_fields`
+ * Move `getattr` warning in deprecated `BaseConfig`
+ * Only hash `model_fields`, not whole `__dict__`
+ * Fix overload position of `computed_field`
+ * Fix issue `unittest.mock` deprecation warnings
+ * Fix `to_snake` conversion
+ * Add support for field `alias` in `dataclass` signature
+ * Fix ordering of keys in `__dict__` with `model_construct` call
+ * Fix usage of `@deprecated`
+ * Add more support for private attributes in `model_construct` call
+ * Support `pydantic.Field(repr=False)` in dataclasses
+ * Override `dataclass_transform` behavior for `RootModel`
+ * Refactor signature generation for simplicity
+ * Fix ordering bug of PlainValidator annotation
+ * Fix `exclude_none` for json serialization of `computed_field`s
+ * Support yyyy-MM-DD string for datetimes
+ * Fix memory leak with recursive definitions creating reference cycles
+ * Add `ConfigDict.ser_json_inf_nan`
+ * Fix validation of `Literal` from JSON keys when used as `dict` key
+ * Fix bug re `custom_init` on members of `Union`
+ * Fix `JsonValue` `bool` serialization
+ * Fix handling of unhashable inputs with `Literal` in `Union`s
+ Fix package description limit
+ * Allow plugins to catch non `ValidationError` errors
+ * Added `validation_error_cause` to config
+ * Allow `str` as argument to `Discriminator`
+ * Add `SchemaSerializer.__reduce__` method to enable pickle serialization
+ * Properly rebuild the `FieldInfo` when a forward ref gets evaluated
+ * Fix failure to load `SecretStr` from JSON (regression in v2.4)
+ * Fix `defer_build` behavior with `TypeAdapter`
+ * Fix: update `TypeVar` handling when default is not set
+ * Raise an error when deleting frozen (model) fields
+ * Use generated alias for aliases that are not specified otherwise
+ * Fix: support `pydantic.Field(kw_only=True)` with inherited dataclasses
+ * Support `validate_call` decorator for methods in classes with `__slots__`
+ * Fix pydantic dataclass problem with `dataclasses.field` default
+ * Support `|` operator (Union) in PydanticRecursiveRef
+ * Add support for `NotRequired` generics in `TypedDict`
+ * Added fix for signature of inherited dataclass
+ * `PrivateAttr` is passed from `Annotated` default position
+ * Don't decode bytes (which may not be UTF8) when displaying SecretBytes
+ * Use `classmethod` instead of `classmethod[Any, Any, Any]`
+ * Clearer error on invalid Plugin
+ * Correct pydantic dataclasses import
+ * Fix `definition-ref` bug with `Dict` keys
+ * Don't accept `NaN` in float and decimal constraints
+ * Add `lax_str` and `lax_int` support for enum values not inherited
+ from str/int
+ * Fix: proper pluralization in `ValidationError` messages
+ * Disallow the string `'-'` as `datetime` input
+ * Fix: NaN and Inf float serialization
+ * Implement optional `number` to `str` coercion
+ * Add `BaseModel.model_validate_strings` and `TypeAdapter.validate_strings`
+ * Add Pydantic `plugins` experimental implementation
+ * Do not override `model_post_init` in subclass with private attrs
+ * Fix config detection for `TypedDict` from grandparent classes
+ * Fix hash function generation for frozen models with unusual MRO
+ * Make `strict` config overridable in field for Path
+ * Use `ser_json_` on default in `GenerateJsonSchema`
+ * Adding a check that alias is validated as an identifier for Python
+ * Raise an error when computed field overrides field
+ * Enforce behavior of private attributes having double leading underscore
+ * Fix generic dataclass fields mutation bug (when using `TypeAdapter`)
+ * Fix `TypeError` on `model_validator` in `wrap` mode
+ * Fixed a regular expression denial of service issue by limiting whitespaces
+ * Fix handling of `UUID` values having `UUID.version=None`
+ * Fix `__iter__` returning private `cached_property` info
+ * Make ModelWrapValidator protocols generic
+ * Make shadowing attributes a warning instead of an error
+ * Document `Base64Str` and `Base64Bytes`
+ * Fix `config.defer_build` for serialization first cases
+ * Support `__get_validators__`
+ * Replace MiMalloc w/ default allocator
+ * Cleaner error for invalid input to `Path` fields
+ * Add section about Constrained classes to the Migration Guide
+ * Fix issue where generic models couldn't be parametrized with BaseModel
+ * add field_serializer to computed_field
+ * fix dataclass annotated before validator called twice
+ * Add benchmark representing FastAPI startup time
+ * Fix json_encoders for Enum subclasses
+ * Revert "Fix default port for mongosrv DSNs (#6827)"
+ * Do not require `validate_assignment` to use `Field.frozen`
+ * Fix generic computed fields
+ * Handle non-json native enum values
+ * Include Field extra keys name in warning
+ * Skip FieldInfo merging when unnecessary
+ * Add `StringConstraints` for use as Annotated metadata
+ * Fix incorrect subclass check for secretstr
+ * Mypy plugin for settings
+ * fast-path checking finite decimals
+ * Fix pydantic dataclasses that use slots with default values
+ * Fix inheritance of hash function for frozen models
+ * Error if an invalid field name is used with Field
+ * Add `GenericModel` to `MOVED_IN_V2`
+ * remove email validation from the north star benchmark
+ * Fix default port for mongosrv DSNs
+ * Fix serialization issue with `InstanceOf`
+ * Add back support for `json_encoders`
+ * Use `WeakValueDictionary` to fix generic memory leak
+ * Add `config.defer_build` to optionally make model building lazy
+ * Revise the section on required / optional / nullable fields.
+ * Replace TransformSchema with GetPydanticSchema
+ * Fix serialization for IPvAny
+ * Touch up Decimal validator
+ * Handle function validators in a discriminated union
+ * Fix pydantic dataclass problem with dataclasses.field default_factory
+ * Produce more accurate signatures for pydantic dataclasses
+ * Ignore unrecognized fields from dataclasses metadata
+- Drop patches Fix-Python-3.12-test-failures.patch and
+ ignore-urllib3-pyopenssl-warning.patch
+- Switch to pyproject macros.
+- Inject mulitbuild.
+
+-------------------------------------------------------------------
+Mon Jan 22 09:12:28 UTC 2024 - Dirk Müller
+
+- update to 1.10.14:
+ * Update install.md
+ * Fixes ci to only deploy docs on release
+ * Fix cached_property handling in dataclasses when copied
+
+-------------------------------------------------------------------
+Thu Nov 16 09:58:50 UTC 2023 - Dirk Müller
+
+- 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
+
+- update to 1.10.9:
+ * Fix trailing zeros not ignored in Decimal validation
+ * Fix mypy plugin for v1.4.0
+ * Add future and past date hypothesis strategies
+ * Discourage usage of Cython 3 with Pydantic 1.x
+
+-------------------------------------------------------------------
+Thu May 25 07:32:32 UTC 2023 - Daniel Garcia
+
+- Update to v1.10.8
+ * Fix a bug in `Literal` usage with `typing-extension==4.6.0`, #5826
+ by @hramezani
+ * This solves the (closed) issue #3849 where aliased fields that use
+ discriminated union fail to validate when the data contains the
+ non-aliased field name, #5736 by @benwah
+ * Update email-validator dependency to >=2.0.0post2, #5627 by
+ @adriangb
+ * update `AnyClassMethod` for changes in
+ [python/typeshed#9771](https://github.com/python/typeshed/issues/9771),
+ #5505 by @ITProKyle
+
-------------------------------------------------------------------
Mon Mar 27 10:00:20 UTC 2023 - Dirk Müller
@@ -144,7 +405,7 @@ Fri Sep 9 00:47:25 UTC 2022 - Steve Kowalik
Tue Jul 19 09:20:43 UTC 2022 - Steve Kowalik
- Add patch remove-pkg_resources.patch:
- * Use packaging, not pkg_resources for versions.
+ * Use packaging, not pkg_resources for versions.
-------------------------------------------------------------------
Sat Jun 18 13:37:28 UTC 2022 - Michael Ströder
@@ -176,7 +437,7 @@ Sat Jun 18 13:37:28 UTC 2022 - Michael Ströder
-------------------------------------------------------------------
Wed Feb 2 04:12:37 UTC 2022 - Steve Kowalik
-- Skip some truculent tests.
+- Skip some truculent tests.
- Clean up non-required Python 3.6 {Build,}Requires.
-------------------------------------------------------------------
@@ -200,7 +461,7 @@ Wed Jan 5 16:08:23 UTC 2022 - Ben Greiner
Thu May 13 11:07:30 UTC 2021 - Markéta Machová
- Update to 1.8.2 (bsc#1186019, CVE-2021-29510)
- * Security fix: Fix date and datetime parsing so passing either 'infinity'
+ * Security fix: Fix date and datetime parsing so passing either 'infinity'
or float('inf') (or their negative values) does not cause an infinite loop
* Allow passing json_encoders in class kwargs
* support arbitrary types with custom __eq__
@@ -361,19 +622,19 @@ Thu Mar 19 13:25:26 UTC 2020 - Marketa Calabkova
* Implement root_validator and rename root errors from __obj__ to __root__
* Added initvars support to post_init_post_parse
* complete rewrite of URL parsing logic
- * BaseSettings now uses the special env settings to define which
+ * BaseSettings now uses the special env settings to define which
environment variables to read, not aliases
* add support for assert statements inside validators
- * Change the precedence of aliases so child model aliases override
+ * Change the precedence of aliases so child model aliases override
parent aliases, including using alias_generator
* Add a mypy plugin for type checking BaseModel.__init__ and more
* Add support for typing.Literal for Python 3.8
* Add a ByteSize type for converting byte string (1GB) to plain bytes
- * Add support for required Optional with name: Optional[AnyType] = Field(...)
+ * Add support for required Optional with name: Optional[AnyType] = Field(...)
and refactor ModelField creation to preserve required parameter value
* Add __eq__ to SecretStr and SecretBytes to allow "value equals"
* Add support for nested generic models
- * alias precedence logic changed so aliases on a field always take
+ * alias precedence logic changed so aliases on a field always take
priority over an alias from alias_generator
* many more fixes and improvements
diff --git a/python-pydantic.spec b/python-pydantic.spec
index 7da4c20..8b5c81e 100644
--- a/python-pydantic.spec
+++ b/python-pydantic.spec
@@ -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
#
# All modifications and additions to the file contributed by third parties
@@ -17,29 +17,50 @@
#
-%define skip_python2 1
-Name: python-pydantic
-Version: 1.10.7
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+%{?sle15_python_module_pythons}
+Name: python-pydantic%{psuffix}
+Version: 2.7.3
Release: 0
Summary: Data validation and settings management using python type hinting
License: MIT
URL: https://github.com/pydantic/pydantic
Source: https://github.com/pydantic/pydantic/archive/v%{version}.tar.gz#/pydantic-%{version}.tar.gz
-# PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed
-# (Pulled in by email-validator)
-Patch0: ignore-urllib3-pyopenssl-warning.patch
-BuildRequires: %{python_module email-validator >= 1.0.3}
+# PATCH-FIX-UPSTREAM gh#pydantic/pydantic#9527
+Patch0: support-pytest-8.patch
+BuildRequires: %{python_module hatch-fancy-pypi-readme}
+BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module packaging}
+BuildRequires: %{python_module pip}
+BuildRequires: %{python_module wheel}
+BuildRequires: fdupes
+BuildRequires: python-rpm-macros
+%if %{with test}
+BuildRequires: %{python_module Faker}
+BuildRequires: %{python_module cloudpickle}
+BuildRequires: %{python_module dirty-equals}
+BuildRequires: %{python_module email-validator >= 2.0}
+BuildRequires: %{python_module pydantic == %{version}}
+BuildRequires: %{python_module pytest-benchmark}
+BuildRequires: %{python_module pytest-examples}
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dotenv >= 0.10.4}
-BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module typing_extensions >= 4.2.0}
-BuildRequires: fdupes
-BuildRequires: python-rpm-macros
-Requires: python-typing_extensions >= 4.2.0
-Suggests: python-email-validator >= 1.0.3
-Suggests: python-python-dotenv >= 0.10.4
+%endif
+Requires: python-annotated-types >= 0.4.0
+%if 0%{?python_version_nodots} < 310
+Requires: python-eval-type-backport
+%endif
+Requires: python-pydantic-core == 2.18.4
+Requires: python-typing_extensions >= 4.6.1
+Suggests: python-email-validator >= 2.0
BuildArch: noarch
%python_subpackages
@@ -50,21 +71,25 @@ Data validation and settings management using Python type hinting.
%autosetup -p1 -n pydantic-%{version}
%build
-%python_build
+%pyproject_wheel
%install
-%python_install
+%if %{without test}
+%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
%check
-# Disable DeprecationWarning to avoid error with the latest setuptools
-# and pkg_resources deprecation
-%pytest -k 'not test_multiple_env_file' -W ignore::DeprecationWarning
+%if %{with test}
+%pytest
+%endif
+%if %{without test}
%files %{python_files}
%license LICENSE
%doc README.md HISTORY.md
%{python_sitelib}/pydantic
-%{python_sitelib}/pydantic-%{version}*-info
+%{python_sitelib}/pydantic-%{version}.dist-info
+%endif
%changelog
diff --git a/support-pytest-8.patch b/support-pytest-8.patch
new file mode 100644
index 0000000..cb06b40
--- /dev/null
+++ b/support-pytest-8.patch
@@ -0,0 +1,382 @@
+From 7fb31529124f51cceb32d1d7b8ae9b58c0606b17 Mon Sep 17 00:00:00 2001
+From: Steve Kowalik
+Date: Thu, 30 May 2024 14:14:04 +1000
+Subject: [PATCH] Ignore other warnings when checking warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Building on Michał's amazing work in PR#9040, extend the pattern to also
+ignore other warnings that are emitted by pytest.warns() when running
+under Pytest 8.x. This also continues to support Pytest 7.x.
+
+Co-authored-by: Michał Górny
+
+Fixes: #9025
+---
+ tests/conftest.py | 2 +-
+ tests/test_config.py | 84 +++++++++++---------
+ tests/test_deprecated.py | 156 ++++++++++++++++++++++----------------
+ tests/test_json_schema.py | 9 ++-
+ tests/test_validators.py | 1 +
+ 5 files changed, 146 insertions(+), 106 deletions(-)
+
+diff --git a/tests/conftest.py b/tests/conftest.py
+index e0c0dee018..421afade2e 100644
+--- a/tests/conftest.py
++++ b/tests/conftest.py
+@@ -49,7 +49,7 @@ def _create_module_file(code, tmp_path, name):
+ def disable_error_urls():
+ # Don't add URLs during docs tests when printing
+ # Otherwise we'll get version numbers in the URLs that will update frequently
+- os.environ['PYDANTIC_ERRORS_OMIT_URL'] = 'true'
++ os.environ['PYDANTIC_ERRORS_INCLUDE_URL'] = 'false'
+
+
+ @pytest.fixture
+diff --git a/tests/test_config.py b/tests/test_config.py
+index 1a5e31628a..31b2320326 100644
+--- a/tests/test_config.py
++++ b/tests/test_config.py
+@@ -1,6 +1,7 @@
+ import json
+ import re
+ import sys
++import warnings
+ from contextlib import nullcontext as does_not_raise
+ from decimal import Decimal
+ from inspect import signature
+@@ -349,45 +350,54 @@ class Model(BaseModel):
+ assert m == m.model_copy()
+
+ def test_config_class_is_deprecated(self):
+- with pytest.warns(
+- PydanticDeprecatedSince20, match='Support for class-based `config` is deprecated, use ConfigDict instead.'
+- ):
+-
+- class Config(BaseConfig):
+- pass
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='Support for class-based `config` is deprecated, use ConfigDict instead.',
++ ):
++
++ class Config(BaseConfig):
++ pass
+
+ def test_config_class_attributes_are_deprecated(self):
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='Support for class-based `config` is deprecated, use ConfigDict instead.',
+- ):
+- assert BaseConfig.validate_assignment is False
+-
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='Support for class-based `config` is deprecated, use ConfigDict instead.',
+- ):
+- assert BaseConfig().validate_assignment is False
+-
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='Support for class-based `config` is deprecated, use ConfigDict instead.',
+- ):
+-
+- class Config(BaseConfig):
+- pass
+-
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='Support for class-based `config` is deprecated, use ConfigDict instead.',
+- ):
+- assert Config.validate_assignment is False
+-
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='Support for class-based `config` is deprecated, use ConfigDict instead.',
+- ):
+- assert Config().validate_assignment is False
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='Support for class-based `config` is deprecated, use ConfigDict instead.',
++ ):
++ assert BaseConfig.validate_assignment is False
++
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='Support for class-based `config` is deprecated, use ConfigDict instead.',
++ ):
++ assert BaseConfig().validate_assignment is False
++
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='Support for class-based `config` is deprecated, use ConfigDict instead.',
++ ):
++
++ class Config(BaseConfig):
++ pass
++
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='Support for class-based `config` is deprecated, use ConfigDict instead.',
++ ):
++ assert Config.validate_assignment is False
++
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='Support for class-based `config` is deprecated, use ConfigDict instead.',
++ ):
++ assert Config().validate_assignment is False
+
+ @pytest.mark.filterwarnings('ignore:.* is deprecated.*:DeprecationWarning')
+ def test_config_class_missing_attributes(self):
+diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py
+index fda6879597..2e58e8b433 100644
+--- a/tests/test_deprecated.py
++++ b/tests/test_deprecated.py
+@@ -1,5 +1,6 @@
+ import platform
+ import re
++import warnings
+ from datetime import date, timedelta
+ from pathlib import Path
+ from types import SimpleNamespace
+@@ -273,8 +274,12 @@ class Model(BaseModel):
+ x: int
+ y: int
+
+- with pytest.warns(PydanticDeprecatedSince20, match='The `parse_raw` method is deprecated'):
+- model = Model.parse_raw('{"x": 1, "y": 2}')
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(PydanticDeprecatedSince20, match='The `parse_raw` method is deprecated'):
++ model = Model.parse_raw('{"x": 1, "y": 2}')
+ assert model.model_dump() == {'x': 1, 'y': 2}
+
+
+@@ -284,9 +289,13 @@ class Model(BaseModel):
+ x: int
+ y: int
+
+- with pytest.warns(PydanticDeprecatedSince20, match='The `parse_raw` method is deprecated'):
+- with pytest.raises(ValidationError, match='1 validation error for Model') as exc_info:
+- Model.parse_raw('invalid')
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(PydanticDeprecatedSince20, match='The `parse_raw` method is deprecated'):
++ with pytest.raises(ValidationError, match='1 validation error for Model') as exc_info:
++ Model.parse_raw('invalid')
+
+ # insert_assert(exc_info.value.errors(include_url=False))
+ assert exc_info.value.errors(include_url=False) == [
+@@ -435,10 +444,14 @@ class Model(BaseModel):
+
+ def test_field_include_deprecation():
+ m = '`include` is deprecated and does nothing. It will be removed, use `exclude` instead'
+- with pytest.warns(PydanticDeprecatedSince20, match=m):
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(PydanticDeprecatedSince20, match=m):
+
+- class Model(BaseModel):
+- x: int = Field(include=True)
++ class Model(BaseModel):
++ x: int = Field(include=True)
+
+
+ def test_unique_items_items():
+@@ -664,10 +677,14 @@ def test_parse_obj():
+ def test_parse_file(tmp_path):
+ path = tmp_path / 'test.json'
+ path.write_text('{"x": 12}')
+- with pytest.warns(
+- PydanticDeprecatedSince20, match='^The `parse_file` method is deprecated; load the data from file,'
+- ):
+- assert SimpleModel.parse_file(str(path)).model_dump() == {'x': 12}
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(
++ PydanticDeprecatedSince20, match='^The `parse_file` method is deprecated; load the data from file,'
++ ):
++ assert SimpleModel.parse_file(str(path)).model_dump() == {'x': 12}
+
+
+ def test_construct():
+@@ -736,61 +753,68 @@ def test_deprecated_module(tmp_path: Path) -> None:
+ class Model(BaseModel):
+ x: int
+
+- assert hasattr(parse_obj_as, '__deprecated__')
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='`parse_obj_as` is deprecated. Use `pydantic.TypeAdapter.validate_python` instead.',
+- ):
+- parse_obj_as(Model, {'x': 1})
+-
+- assert hasattr(schema_json_of, '__deprecated__')
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='`schema_json_of` is deprecated. Use `pydantic.TypeAdapter.json_schema` instead.',
+- ):
+- schema_json_of(Model)
+-
+- assert hasattr(schema_of, '__deprecated__')
+- with pytest.warns(
+- PydanticDeprecatedSince20, match='`schema_of` is deprecated. Use `pydantic.TypeAdapter.json_schema` instead.'
+- ):
+- schema_of(Model)
+-
+- assert hasattr(load_str_bytes, '__deprecated__')
+- with pytest.warns(PydanticDeprecatedSince20, match='`load_str_bytes` is deprecated.'):
+- load_str_bytes('{"x": 1}')
+-
+- assert hasattr(load_file, '__deprecated__')
+- file = tmp_path / 'main.py'
+- file.write_text('{"x": 1}')
+- with pytest.warns(PydanticDeprecatedSince20, match='`load_file` is deprecated.'):
+- load_file(file)
+-
+- assert hasattr(pydantic_encoder, '__deprecated__')
+- with pytest.warns(
+- PydanticDeprecatedSince20,
+- match='`pydantic_encoder` is deprecated, use `pydantic_core.to_jsonable_python` instead.',
+- ):
+- pydantic_encoder(Model(x=1))
+-
+- assert hasattr(custom_pydantic_encoder, '__deprecated__')
+- with pytest.warns(
+- PydanticDeprecatedSince20, match='`custom_pydantic_encoder` is deprecated, use `BaseModel.model_dump` instead.'
+- ):
+- custom_pydantic_encoder({int: lambda x: str(x)}, Model(x=1))
+-
+- assert hasattr(timedelta_isoformat, '__deprecated__')
+- with pytest.warns(PydanticDeprecatedSince20, match='`timedelta_isoformat` is deprecated.'):
+- timedelta_isoformat(timedelta(seconds=1))
+-
+- with pytest.warns(
+- PydanticDeprecatedSince20, match='The `validate_arguments` method is deprecated; use `validate_call` instead.'
+- ):
+-
+- def test(a: int, b: int):
+- pass
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ assert hasattr(parse_obj_as, '__deprecated__')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='`parse_obj_as` is deprecated. Use `pydantic.TypeAdapter.validate_python` instead.',
++ ):
++ parse_obj_as(Model, {'x': 1})
++
++ assert hasattr(schema_json_of, '__deprecated__')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='`schema_json_of` is deprecated. Use `pydantic.TypeAdapter.json_schema` instead.',
++ ):
++ schema_json_of(Model)
++
++ assert hasattr(schema_of, '__deprecated__')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='`schema_of` is deprecated. Use `pydantic.TypeAdapter.json_schema` instead.',
++ ):
++ schema_of(Model)
++
++ assert hasattr(load_str_bytes, '__deprecated__')
++ with pytest.warns(PydanticDeprecatedSince20, match='`load_str_bytes` is deprecated.'):
++ load_str_bytes('{"x": 1}')
++
++ assert hasattr(load_file, '__deprecated__')
++ file = tmp_path / 'main.py'
++ file.write_text('{"x": 1}')
++ with pytest.warns(PydanticDeprecatedSince20, match='`load_file` is deprecated.'):
++ load_file(file)
++
++ assert hasattr(pydantic_encoder, '__deprecated__')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='`pydantic_encoder` is deprecated, use `pydantic_core.to_jsonable_python` instead.',
++ ):
++ pydantic_encoder(Model(x=1))
++
++ assert hasattr(custom_pydantic_encoder, '__deprecated__')
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='`custom_pydantic_encoder` is deprecated, use `BaseModel.model_dump` instead.',
++ ):
++ custom_pydantic_encoder({int: lambda x: str(x)}, Model(x=1))
++
++ assert hasattr(timedelta_isoformat, '__deprecated__')
++ with pytest.warns(PydanticDeprecatedSince20, match='`timedelta_isoformat` is deprecated.'):
++ timedelta_isoformat(timedelta(seconds=1))
++
++ with pytest.warns(
++ PydanticDeprecatedSince20,
++ match='The `validate_arguments` method is deprecated; use `validate_call` instead.',
++ ):
++
++ def test(a: int, b: int):
++ pass
+
+- validate_arguments()(test)
++ validate_arguments()(test)
+
+
+ def test_deprecated_color():
+diff --git a/tests/test_json_schema.py b/tests/test_json_schema.py
+index e6c60557a5..85d833c15c 100644
+--- a/tests/test_json_schema.py
++++ b/tests/test_json_schema.py
+@@ -5,6 +5,7 @@
+ import re
+ import sys
+ import typing
++import warnings
+ from datetime import date, datetime, time, timedelta
+ from decimal import Decimal
+ from enum import Enum, IntEnum
+@@ -1385,8 +1386,12 @@ class Model(BaseModel):
+ class MyGenerator(GenerateJsonSchema):
+ ignored_warning_kinds = ()
+
+- with pytest.warns(PydanticJsonSchemaWarning, match=warning_match):
+- model_schema = Model.model_json_schema(schema_generator=MyGenerator)
++ with warnings.catch_warnings():
++ # we need to explicitly ignore the other warning in pytest-8
++ # TODO: rewrite it to use two nested pytest.warns() when pytest-7 is no longer supported
++ warnings.simplefilter('ignore')
++ with pytest.warns(PydanticJsonSchemaWarning, match=warning_match):
++ model_schema = Model.model_json_schema(schema_generator=MyGenerator)
+ assert model_schema == {
+ 'properties': {'callback': {'title': 'Callback', 'type': 'integer'}},
+ 'title': 'Model',
+diff --git a/tests/test_validators.py b/tests/test_validators.py
+index 52a8bda88f..b286c49b1b 100644
+--- a/tests/test_validators.py
++++ b/tests/test_validators.py
+@@ -2554,6 +2554,7 @@ class Model(BaseModel):
+ assert Model(x=1, y=2).model_dump() == {'x': 2, 'y': 3}
+
+
++@pytest.mark.filterwarnings('ignore:Pydantic V1 style `@root_validator` validators are deprecated.*:pydantic.warnings.PydanticDeprecatedSince20')
+ def test_root_validator_allow_reuse_same_field():
+ with pytest.warns(UserWarning, match='`root_val` overrides an existing Pydantic `@root_validator` decorator'):
+