Open GeorgeFischhof opened 1 month ago
Hi, In the meantime it's got to mind that if I use managed version (closure created, and function returned from fixture) then users will be created for every test function, so the time consuming thing remains.
BR, George
This sounds a lot like #1681 to me - unfortunately there was unforeseen trouble with the implementation of that and we needed to revert it again.
What's the problem this feature will solve?
I create random users for the tests. I use factories according to https://docs.pytest.org/en/latest/how-to/fixtures.html#factories-as-fixtures
The user creation is quite expensive (in time), so I would like to create only one user for negative test cases, and one for every positive test case when the user state is changed during the test.
My idea was that create user for negative tests with module scope and use function scope for positive ones. But it is not possible. (I duplicated the fixtures with different scopes, but it is not good)
Describe the solution you'd like
I do not know how to solve this
Alternative Solutions
As I wrote this feature request, it got to my mind that there is a class scope, and that can solve this.: Create a class for negative test cases and one class for each positive, and it solves the issue.
Perhaps documenting this with an example (two class type: one for all negative test cases and several for the positive ones) should be enough / good
BR, George
Additional context