-
Notifications
You must be signed in to change notification settings - Fork 344
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
Do common db setup between tests once #105
Comments
I think it can be done with some kind of ordering/grouping of tests execution. E.g.:
I've done some kind of similar features in my project, but it is still non-usable draft, which works only in few cases :( But it speeds up part of my test suite to run 5-6 times faster than before. Actually it depends on complexity of DB fixture. |
for session-scoped data you can tap into _django_db_setup as a workaround:
I'd be interested in having this for smaller scopes - maybe using some kind of subtransactions. |
We also have a problem with this as we are using parameterize a lot for read-only access. |
We are having some overlapping discussion on this in #514, I'll close this one in favor of that. |
It would be useful if I could do some common database setup that's shared between tests (like loading some large fixture data or something), just once for the test run rather than for every test, for faster performance. The test would still be wrapped in a transaction, so any db changes in tests would be rolled back to the original state.
However this doesn't seem possible in pytest_django, since the
db
fixture is only function scoped, whereas I might want to do this database setup on a module or session scope.The text was updated successfully, but these errors were encountered: