Skip to content

[Bug]: Regression in Python 3.14: TestImportModelCreate::test_dynamic_model #1009

Open
@musicinmybrain

Description

@musicinmybrain

Actual Behavior

============================================== FAILURES ==============================================
______________________________ TestImportModelCreate.test_dynamic_model ______________________________

self = <test_factories.TestImportModelCreate object at 0x7fa08a09df90>

    def test_dynamic_model(self):
        factory = ModelPathFactory()

        schema = SchemaPath.from_dict({"x-model": "TestModel"})
        test_model_class = factory.create(schema, ["name"])

        assert is_dataclass(test_model_class)
        assert test_model_class.__name__ == "TestModel"
        assert list(test_model_class.__dataclass_fields__.keys()) == ["name"]
>       assert test_model_class.__dataclass_fields__["name"].type == str(Any)
E       AssertionError: assert typing.Any == 'typing.Any'
E        +  where typing.Any = Field(name='name',type=typing.Any,default=<dataclasses._MISSING_TYPE object at 0x7fa08ea36e40>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fa08ea36e40>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,doc=None,_field_type=_FIELD).type
E        +  and   'typing.Any' = str(Any)

factory    = <openapi_core.extensions.models.factories.ModelPathFactory object at 0x7fa088126990>
schema     = SchemaPath('')
self       = <test_factories.TestImportModelCreate object at 0x7fa08a09df90>
test_model_class = <class 'openapi_core.extensions.models.factories.TestModel'>

tests/unit/extensions/test_factories.py:36: AssertionError
========================================== warnings summary ==========================================
[…]
====================================== short test summary info =======================================
FAILED tests/unit/extensions/test_factories.py::TestImportModelCreate::test_dynamic_model - AssertionError: assert typing.Any == 'typing.Any'
================= 1 failed, 1411 passed, 2 skipped, 21 xfailed, 1 warning in 22.67s ==================

Expected Behavior

All tests pass.

Steps to Reproduce

diff --git a/pyproject.toml b/pyproject.toml
index 4621aaa..74d8376 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -133,7 +133,6 @@ addopts = """
 """
 asyncio_mode = "auto"
 filterwarnings = [
-    "error",
     # falcon.media.handlers uses cgi to parse data
     "ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning",
     "ignore:co_lnotab is deprecated, use co_lines instead:DeprecationWarning",
$ python3.14 -m venv _e
$ . _e/bin/activate
(_e) $ PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 poetry install
(_e) $ pip install aioitertools
(_e) $ PYTHONWARNINGS='ignore::DeprecationWarning' pytest --ignore=tests/integration/contrib/fastapi/test_fastapi_project.py

OpenAPI Core Version

0.19.5 (1ece445)

OpenAPI Core Integration

N/A

Affected Area(s)

???

References

No response

Anything else we need to know?

$ python3.14 --version
Python 3.14.0b2

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugIndicates an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions