-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fixture execution order #805
Comments
pytest currently doesn't try to take in account subclasses when executing fixtures. One way to "enforce" one fixture to execute before the other is to make each fixture depend on a fixture of its subclass, for example make One of the design goals for fixtures is modularity, so that fixtures can be used in different contexts without test functions knowing about them. An advantage of this is that fixtures can easily be defined at a module first and then later, when proven useful to be used in other tests/modules, moved to a Hope that helps! 😄 |
Thanks. If it makes sense can we explicit add subclassing fixtures won't work in |
Sure, good idea. Could you open a PR? 😄 |
Yes, I will do it. |
Output
I am using multiple classes with mixin approach to write test cases. Fixtures are executed alphabetically, not in the order.
I am expecting the fixtures to be run in
Meh1 -> Foo1 -> Bar1 -> TestBaz1
. Addingscope=class
doesn't help. What am I doing wrong ?The text was updated successfully, but these errors were encountered: