-
Notifications
You must be signed in to change notification settings - Fork 346
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
Order of settings and transactional_db fixtures #870
Comments
I tried to follow what you are saying but the paragraph is a bit long and hard to understand. Can you rephrase it such that a simpleton like me can understand? 😄 The deputy likes dots! |
Simplification would be all pytest-django Django fixtures can depend upon the settings in a way or another but the ordering between the settings fixtures and other fixtures is mainly random. It would be useful that this order is fixed and documented. You can ignore my particular solution in the pull request, it just illustrates the problem. Note that it is a fundamental problem with the way pytest fixtures works, I think that without explicit dependencies between fixtures their ordering depend on their name or point of definition, I don't remember exactly. There is no way to indicate such fixture must run around another without depending on it. |
I use both in my tests and I created a media fixture (creating a temporary media directory and using the settings fixture) with autouse=True, due to alphabetic order it made the settings fixture run before the transactional_db fixture, but my post_migrate handler creating basic models depend upon the settings, in a test testing modification of those settings the teardown of transactional_db calling the flush() run with the modified settings instead of the default settings, modifying the default state of the database.
I think that a way of forcing run of setting before transactional_db must be found, as the post_migrate handler can depend upon the settings.
The text was updated successfully, but these errors were encountered: