Django manage.py test - how to tell it to not create/delete test database

1.9k Views Asked by At

I am running a few test cases in Django 1.6, and everytime I run a test, it creates the test DB and deletes it at the end. This takes up a some time and is really irritating when I am iterating to find simple errors.

Is there a way I can specify to manage.py that it should not create/delete databases every time a test is run?

2

There are 2 best solutions below

0
SunnySydeUp On

You won't be able to with Django's default test runner. However, if you get the django-nose package, you can enable database reuse with:

REUSE_DB=1 ./manage.py test

However, you should not do this if you make any changes to your database schema.

0
Oleksandr Zelentsov On

as of now, it is possible, i think, with adding a keyword argument to test running:

python manage.py test --keepdb