-
Notifications
You must be signed in to change notification settings - Fork 341
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
--reuse-db and --create-db not working together #411
Comments
I've had a look at the code and can see a slight logic change in a recent refactor (#362) causes this. The logic in
Now it is:
where the It's not a huge deal but it makes the docs here not incorrect but a bit misleading since the database is created twice. |
Thanks for tracking it down! We should fix this and bring back the old behavior for sure. |
Sorry, it is not a pull request. The fix still seems to be valid. |
The PR is here: #476 |
I noticed the below issue when using the workflow presented here: https://pytest-django.readthedocs.io/en/latest/database.html#example-work-flow-with-reuse-db-and-create-db. It seems like the behaviour changed in a recent version although it's possible I never noticed this occurred.
When I run the tests passing the
--create-db
flag, the database is recreated and the migrations are run (notice the time). The database, however, is dropped despite the--reuse-db
flag being passed viaaddopts
.When I next run the tests without the
--create-db
flag the database is again recreated and the migrations are run because it was previously dropped.If I run the tests a third time exactly as above, the database is properly reused:
The text was updated successfully, but these errors were encountered: