Search code examples
pythondatabasedjangotestinghudson

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


Solution

  • 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;)