#33184 closed New feature (wontfix)
Allow a way to create a new test database AND keep it for the next test run
| Reported by: | Valentijn Scholten | Owned by: | nobody |
|---|---|---|---|
| Component: | Testing framework | Version: | 3.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I am running multiple test suites serially. I'd like to ensure the first starts with a fresh test database, but reuse that database in the following test runs.
Currently (to my undestanding) this is not possible with --keepdb or any of the other parameters.
The --keepdb flag when running tests does two things:
1) Reuse existing test database if found
2) Leave test database intact after completing the tests
So step 1 prevents me from obtaining my desired scenario.
I could run the tests without --keepdb and use --no-input to force the creation of a new test database. But in that case the database will be destroyed after running the tests.
Suggestion:
- Add a '--createdb
parameter to "force" the creation of a new test database, while allowing--keepdb` to be used in the same run.
Change History (2)
comment:2 by , 4 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
I am running multiple test suites serially. ...
Assuming I've understood correctly, I think Mateusz's point is right.
- Use
--keepdbfor all runs, which should create the DB on the first pass. - Run
dropdb(Postgres) orrm(Sqlite) or equivalent, after the last run.
For the dropdb step, I don't think that replicating existing tools inside django-admin is going to be worth it.
Why add parameter when you can just create db in separate command?