Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util.pydantic.exclude_model_fields fails when inside freezegun.freeze_time #3869

khvn26 opened this issue May 1, 2024 · 2 comments


Copy link

khvn26 commented May 1, 2024

The code here causes tests to fail with the following error:

pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for [class 'datetime.datetime']('datetime.datetime'). Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

Related discussion: pydantic/pydantic#9343

@khvn26 khvn26 self-assigned this May 1, 2024
Copy link
Member Author

khvn26 commented May 1, 2024

Currently, the way to fix this is to add the following to api/

def pytest_sessionstart(session):
    from environments.sdk.schemas import SDKEnvironmentDocumentModel

A less hacky way to avoid the error would be something like

import freezegun


but it will need a bit more trial and error to determine the exact module name to ignore.

Copy link

Fixed by workaround applied in #3876. We should in future be able to remove the workaround if/when freezegun resolves the issue, but the workaround is sufficient for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants