keepdb with flush option

38 views
Skip to first unread message

Brice Parent

unread,
Feb 7, 2018, 5:27:30 AM2/7/18
to django-d...@googlegroups.com

Hi everyone,

Right now, when testing, we have the choice to either :

  • create a new empty database to launch the tests with
  • reuse an existing database with all its data (--keepdb)

I think we're missing a third option, here :

  • reuse an existing database, but flush its contents before (or after, or both) launching the tests (--flushdb? --keepdb --flush?)

The reason for that is that we don't always want to/may give django's db user the ability to create and delete database, but we may still want to start with a fresh one (otherwise, we wouldn't need --keepdb, it would be the normal behaviour). As there's already a management command to flush the db, I don't expect this to be a huge work, but I might be missing something. If there's already a way to do that without creating a custom test runner, thanks for pointing me at it and sorry for your time!

Any thoughts ?

-Brice

Reply all
Reply to author
Forward
0 new messages