Skip to content

Adjust test when inserting non-nullable email field #3

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

Closed
wants to merge 1 commit into from
Closed

Adjust test when inserting non-nullable email field #3

wants to merge 1 commit into from

Conversation

stephane
Copy link

@stephane stephane commented Sep 10, 2021

Without this workaround, the test raises an Pydantic error:

tests/test_fastapi_users_db_sqlalchemy.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   pydantic.error_wrappers.ValidationError: 1 validation error for UserDB
E   email
E     value is not a valid email address (type=value_error.email)

pydantic/main.py:406: ValidationError

My env uses pydantic==1.8.2 (same version as the CI so I don't know why the behavior is different for me).

@frankie567
Copy link
Member

Never paid attention to that but, indeed, Pydantic should definitely raise an error first 🤔 Will try to investigate why it works on my machine and CI ; because yes, it shouldn't work 😅

@frankie567
Copy link
Member

Ok, so I've run again the tests in CI and local machine and getting the same error now; which is expected. Actually, I've reworked the base models in the base library some time ago and didn't update the database libraries accordingly.

I'll update every projects with the .construct syntax of Pydantic, so I won't keep your proposal, but you definitely raised an important point here. Thank you 🙏

@stephane
Copy link
Author

Thank you for your review. 👍

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

Successfully merging this pull request may close these issues.

2 participants