Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically destroy django test database

I'm currently trying to automate Django tests using Hudson CI, and am struggling to find an option that will automatically destroy the test database if it already exists (typically it will ask for confirmation to destroy it, which the automatic testing obviously cannot provide for).

Any suggestions would be much appreciated!

Cheers, R

like image 339
Ric W Avatar asked Aug 24 '12 16:08

Ric W


1 Answers

Use --help to see the docs of the test command:

>>> ./manage.py test --help    Usage: ./manage.py test [options] [appname ...]  Runs the test suite for the specified applications, or the entire site if no apps are specified.  [...]  --noinput             Tells Django to NOT prompt the user for input of any                       kind. 

And use --noinput which defaults to destroying the test db;)

like image 160
jpic Avatar answered Sep 30 '22 23:09

jpic