public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pydantic-core] rawhide: Backport upstream patch needed for compatibility with pytest 9.1
@ 2026-07-02 5:22
0 siblings, 0 replies; only message in thread
From: @ 2026-07-02 5:22 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-pydantic-core
Branch : rawhide
Commit : 04b694932aea4e1475bb0f576e1e26447749e1ae
Author : Tomáš Hrnčiar <thrnciar@redhat.com>
Date : 2026-07-01T13:45:47+00:00
Stats : +253/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-pydantic-core/c/04b694932aea4e1475bb0f576e1e26447749e1ae?branch=rawhide
Log:
Backport upstream patch needed for compatibility with pytest 9.1
---
diff --git a/fix-pytest-9.1.patch b/fix-pytest-9.1.patch
new file mode 100644
index 0000000..7e4988c
--- /dev/null
+++ b/fix-pytest-9.1.patch
@@ -0,0 +1,248 @@
+diff --git a/tests/benchmarks/test_micro_benchmarks.py b/tests/benchmarks/test_micro_benchmarks.py
+index 65efdce7cfc..b7123445c6d 100644
+--- a/tests/benchmarks/test_micro_benchmarks.py
++++ b/tests/benchmarks/test_micro_benchmarks.py
+@@ -39,7 +39,8 @@
+
+ class TestBenchmarkSimpleModel:
+ @pytest.fixture(scope='class')
+- def core_validator_fs(self):
++ @classmethod
++ def core_validator_fs(cls):
+ class CoreModel:
+ __slots__ = '__dict__', '__pydantic_fields_set__', '__pydantic_extra__', '__pydantic_private__'
+
+@@ -81,7 +82,8 @@ def test_core_json_fs(self, core_validator_fs, benchmark):
+
+ class TestModelLarge:
+ @pytest.fixture(scope='class')
+- def core_model_validator(self):
++ @classmethod
++ def core_model_validator(cls):
+ class CoreModel:
+ __slots__ = '__dict__', '__pydantic_fields_set__', '__pydantic_extra__', '__pydantic_private__'
+
+@@ -567,7 +569,8 @@ def test_bytes_core(benchmark):
+
+ class TestBenchmarkDateTime:
+ @pytest.fixture(scope='class')
+- def core_validator(self):
++ @classmethod
++ def core_validator(cls):
+ class CoreModel:
+ __slots__ = '__dict__', '__pydantic_fields_set__', '__pydantic_extra__', '__pydantic_private__'
+
+@@ -581,19 +584,23 @@ class CoreModel:
+ )
+
+ @pytest.fixture(scope='class')
+- def datetime_raw(self):
++ @classmethod
++ def datetime_raw(cls):
+ return datetime.now(timezone.utc) + timedelta(days=1)
+
+ @pytest.fixture(scope='class')
+- def datetime_str(self, datetime_raw):
++ @classmethod
++ def datetime_str(cls, datetime_raw):
+ return str(datetime_raw)
+
+ @pytest.fixture(scope='class')
+- def python_data_dict(self, datetime_raw):
++ @classmethod
++ def python_data_dict(cls, datetime_raw):
+ return {'dt': datetime_raw}
+
+ @pytest.fixture(scope='class')
+- def json_dict_data(self, datetime_str):
++ @classmethod
++ def json_dict_data(cls, datetime_str):
+ return json.dumps({'dt': datetime_str})
+
+ @pytest.mark.benchmark(group='datetime model - python')
+@@ -631,7 +638,8 @@ def test_core_future_str(self, benchmark, datetime_str):
+
+ class TestBenchmarkDateX:
+ @pytest.fixture(scope='class')
+- def validator(self):
++ @classmethod
++ def validator(cls):
+ return SchemaValidator(core_schema.date_schema())
+
+ @pytest.mark.benchmark(group='date from date')
+@@ -712,7 +720,8 @@ def validate_with_expected_error():
+
+ class TestBenchmarkUUID:
+ @pytest.fixture(scope='class')
+- def core_validator(self):
++ @classmethod
++ def core_validator(cls):
+ class CoreModel:
+ __slots__ = '__dict__', '__pydantic_fields_set__', '__pydantic_extra__', '__pydantic_private__'
+
+@@ -726,11 +735,13 @@ class CoreModel:
+ )
+
+ @pytest.fixture(scope='class')
+- def validator(self):
++ @classmethod
++ def validator(cls):
+ return SchemaValidator(core_schema.uuid_schema())
+
+ @pytest.fixture(scope='class')
+- def pydantic_validator(self):
++ @classmethod
++ def pydantic_validator(cls):
+ def to_UUID(v: Any) -> UUID:
+ if isinstance(v, UUID):
+ return v
+@@ -780,19 +791,23 @@ def test_uuid_from_uuid_pyd(self, benchmark, pydantic_validator):
+ benchmark(pydantic_validator.validate_python, UUID('12345678-1234-5678-1234-567812345678'))
+
+ @pytest.fixture(scope='class')
+- def uuid_raw(self):
++ @classmethod
++ def uuid_raw(cls):
+ return UUID('12345678-1234-5678-1234-567812345678')
+
+ @pytest.fixture(scope='class')
+- def uuid_str(self, uuid_raw):
++ @classmethod
++ def uuid_str(cls, uuid_raw):
+ return str(uuid_raw)
+
+ @pytest.fixture(scope='class')
+- def python_data_dict(self, uuid_raw):
++ @classmethod
++ def python_data_dict(cls, uuid_raw):
+ return {'u': uuid_raw}
+
+ @pytest.fixture(scope='class')
+- def json_dict_data(self, uuid_str):
++ @classmethod
++ def json_dict_data(cls, uuid_str):
+ return json.dumps({'u': uuid_str})
+
+ @pytest.mark.benchmark(group='uuid model - python')
+@@ -1361,11 +1376,13 @@ def f(v: int, info: core_schema.ValidationInfo) -> int:
+
+ class TestBenchmarkDecimal:
+ @pytest.fixture(scope='class')
+- def validator(self):
++ @classmethod
++ def validator(cls):
+ return SchemaValidator(core_schema.decimal_schema())
+
+ @pytest.fixture(scope='class')
+- def pydantic_validator(self):
++ @classmethod
++ def pydantic_validator(cls):
+ Decimal = decimal.Decimal
+
+ def to_decimal(v: str) -> decimal.Decimal:
+diff --git a/tests/benchmarks/test_serialization_micro.py b/tests/benchmarks/test_serialization_micro.py
+index a7c7a54ef5f..6712d0a5e7e 100644
+--- a/tests/benchmarks/test_serialization_micro.py
++++ b/tests/benchmarks/test_serialization_micro.py
+@@ -10,7 +10,8 @@
+
+ class TestBenchmarkSimpleModel:
+ @pytest.fixture(scope='class')
+- def core_schema(self):
++ @classmethod
++ def core_schema(cls):
+ class CoreModel:
+ __slots__ = '__dict__', '__pydantic_fields_set__', '__pydantic_extra__', '__pydantic_private__'
+
+@@ -32,11 +33,13 @@ class CoreModel:
+ }
+
+ @pytest.fixture(scope='class')
+- def core_validator(self, core_schema):
++ @classmethod
++ def core_validator(cls, core_schema):
+ return SchemaValidator(core_schema)
+
+ @pytest.fixture(scope='class')
+- def core_serializer(self, core_schema):
++ @classmethod
++ def core_serializer(cls, core_schema):
+ return SchemaSerializer(core_schema)
+
+ data = {'name': 'John', 'age': 42, 'friends': list(range(200)), 'settings': {f'v_{i}': i / 2.0 for i in range(50)}}
+diff --git a/tests/test_docstrings.py b/tests/test_docstrings.py
+index bfde27c3d0a..d8057432d1f 100644
+--- a/tests/test_docstrings.py
++++ b/tests/test_docstrings.py
+@@ -18,7 +18,7 @@ def find_examples(*args, **kwargs):
+
+ @pytest.mark.skipif(CodeExample is None or sys.platform not in {'linux', 'darwin'}, reason='Only on linux and macos')
+ @pytest.mark.parametrize(
+- 'example', find_examples(str(PYDANTIC_CORE_DIR / 'python/pydantic_core/core_schema.py')), ids=str
++ 'example', list(find_examples(str(PYDANTIC_CORE_DIR / 'python/pydantic_core/core_schema.py'))), ids=str
+ )
+ @pytest.mark.thread_unsafe # TODO investigate why pytest_examples seems to be thread unsafe here
+ def test_docstrings(example: CodeExample, eval_example: EvalExample):
+@@ -33,7 +33,7 @@ def test_docstrings(example: CodeExample, eval_example: EvalExample):
+
+
+ @pytest.mark.skipif(CodeExample is None or sys.platform not in {'linux', 'darwin'}, reason='Only on linux and macos')
+-@pytest.mark.parametrize('example', find_examples(str(PYDANTIC_CORE_DIR / 'README.md')), ids=str)
++@pytest.mark.parametrize('example', list(find_examples(str(PYDANTIC_CORE_DIR / 'README.md'))), ids=str)
+ @pytest.mark.thread_unsafe # TODO investigate why pytest_examples seems to be thread unsafe here
+ def test_readme(example: CodeExample, eval_example: EvalExample):
+ eval_example.set_config(line_length=100, quotes='single')
+diff --git a/tests/validators/test_union.py b/tests/validators/test_union.py
+index 8169c91535c..268e5a40b56 100644
+--- a/tests/validators/test_union.py
++++ b/tests/validators/test_union.py
+@@ -61,12 +61,13 @@ class ModelB:
+ pass
+
+ @pytest.fixture(scope='class')
+- def schema_validator(self) -> SchemaValidator:
++ @classmethod
++ def schema_validator(cls) -> SchemaValidator:
+ return SchemaValidator(
+ schema=core_schema.union_schema(
+ choices=[
+ core_schema.model_schema(
+- cls=self.ModelA,
++ cls=cls.ModelA,
+ schema=core_schema.model_fields_schema(
+ fields={
+ 'a': core_schema.model_field(schema=core_schema.int_schema()),
+@@ -75,7 +76,7 @@ def schema_validator(self) -> SchemaValidator:
+ ),
+ ),
+ core_schema.model_schema(
+- cls=self.ModelB,
++ cls=cls.ModelB,
+ schema=core_schema.model_fields_schema(
+ fields={
+ 'c': core_schema.model_field(schema=core_schema.int_schema()),
+@@ -124,12 +125,13 @@ class ModelB:
+ pass
+
+ @pytest.fixture(scope='class')
+- def schema_validator(self) -> SchemaValidator:
++ @classmethod
++ def schema_validator(cls) -> SchemaValidator:
+ return SchemaValidator(
+ schema=core_schema.union_schema(
+ choices=[
+ core_schema.model_schema(
+- cls=self.ModelA,
++ cls=cls.ModelA,
+ schema=core_schema.model_fields_schema(
+ fields={
+ 'a': core_schema.model_field(schema=core_schema.int_schema()),
+@@ -138,7 +140,7 @@ def schema_validator(self) -> SchemaValidator:
+ ),
+ ),
+ core_schema.model_schema(
+- cls=self.ModelB,
++ cls=cls.ModelB,
+ schema=core_schema.model_fields_schema(
+ fields={
+ 'a': core_schema.model_field(schema=core_schema.int_schema()),
diff --git a/python-pydantic-core.spec b/python-pydantic-core.spec
index d5add0d..adc6cc3 100644
--- a/python-pydantic-core.spec
+++ b/python-pydantic-core.spec
@@ -32,6 +32,11 @@ Patch: 0001-Fix-test-assertion-to-account-for-change-in-rust-uuid.patch
# https://github.com/pydantic/pydantic/pull/13301
Patch: pydantic_core-2.46.4-pyo3-0.29.patch
+# Compatibility with pytest 9.1
+# The patch is manually adjusted from the upstream
+# https://github.com/pydantic/pydantic/commit/f257d01
+Patch: fix-pytest-9.1.patch
+
BuildRequires: python3-devel
BuildRequires: cargo-rpm-macros >= 24
BuildRequires: tomcli
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-02 5:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-02 5:22 [rpms/python-pydantic-core] rawhide: Backport upstream patch needed for compatibility with pytest 9.1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox