How to automatically destroy django test database

PythonDatabaseDjangoTestingHudson

Python Problem Overview


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

Python Solutions


Solution 1 - Python

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRic WView Question on Stackoverflow
Solution 1 - PythonjpicView Answer on Stackoverflow