-
Notifications
You must be signed in to change notification settings - Fork 46
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
_notification_type_cache on NotificationType seems to cause errors with tests #34
Comments
Yeah, this sounds like transactions being rolled back after each test case?
You could empty the cache in |
Yup, transactions seem to be rolled back after each test case. Good call on directly emptying cache. It feels a little hacky but I'm now using the following:
I don't know where (if anywhere) this should be noted for anyone who runs into this in the future. Perhaps this issue existing is sufficient. |
@mikhuang I'm pretty sure this is fixed now, would you mind testing 1.0b5 without your work-around? :) Thanks for reporting! |
Sorry for the delay, thanks for checking in! Unfortunately, I still seem to need my workaround as I get the same error without it:
Specifically, I don't believe any NotificationTypes are added or deleted between my tests so I imagine |
How do you create notification types in your tests? Creating them should purge the cache because of the signals.. but there might be something I've overlooked |
Sorry, not sure what you mean (also sorry for the delay). I don't directly call |
It's possible that transaction rollbacks can happen without the cache being cleared. So for instance:
|
In the tests for my application it seems that NotificationType is cleared after running each TestCase. This leads _notification_type_cache to no longer be valid. My current workaround is to manually create any needed NotificationType objects at the start of each test. Given the nature of how _notification_type_cache should work, I'm not sure if there's anything to do about this beyond mentioning it in documentation. Thoughts?
The text was updated successfully, but these errors were encountered: