-
Notifications
You must be signed in to change notification settings - Fork 2
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
Warnings during ORM creation due to SQLModel metaclass persistence #48
Comments
Persisting here: |
Discussion on 20 May 2023: |
Partial fix implemented where:
If default_registry is disposed of between tests, this clears the persistent data and the warning no longer fires. Unfortunately, this appears to only work in the |
Ok, this is now solved. Looks like it was only one remaining test that was producing these. Placing it within a context manager solved the issue. |
Encountered during pytesting:
This appears to stem from the fact that the SQLModel metaclass is persistent during our pytest testing and contains the tablenames from the previous pytest:
![image](https://private-user-images.githubusercontent.com/125581724/240681952-299e3ddf-8587-4f4e-9787-d0666d16861a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA2NTA2ODksIm5iZiI6MTcyMDY1MDM4OSwicGF0aCI6Ii8xMjU1ODE3MjQvMjQwNjgxOTUyLTI5OWUzZGRmLTg1ODctNGY0ZS05Nzg3LWQwNjY2ZDE2ODYxYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxMFQyMjI2MjlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yM2YzYjk4ODI5NDc3ZGZmMjU0MWVlOGE3YzU5NWYwNjA0M2Q2ZTI5M2YzMjU4YWFhZjI3ZDc0ZWU1M2M3MzZlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.WFdu7VgVwUta1w2X6syq_uiKcPzUr4X_eM16VZUbZW0)
In the next test, we create ORMs with the same names, so we get a warning that they already exist.
In the above example, the warning will fire when
psm2
is created since SQLModel still contains the tablenames from the creation ofpsm
.We see this warning fire over and over during pytesting because we create many new pipestatmanger objects during testing that all end up sharing the SQLModel metaclass.
Originally posted by @donaldcampbelljr in #26 (comment)
The text was updated successfully, but these errors were encountered: