Closed
Description
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 via addopts
.
$ pytest tests/app --create-db
...............................................................................................................................
127 passed in 8.23 seconds
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.
$ pytest tests/app
...............................................................................................................................
127 passed in 7.01 seconds
If I run the tests a third time exactly as above, the database is properly reused:
$ pytest tests/app
...............................................................................................................................
127 passed in 1.12 seconds
Metadata
Metadata
Assignees
Labels
No labels