user469652
user469652

Reputation: 51211

Django: How to keep the test database when the test is finished?

Some of my requirements are these:

I am not a pro in test, but these have to achieved, anyone professional who can suggest a best practice in this area?

Thanks very much for your help!

Upvotes: 19

Views: 17012

Answers (3)

Koed00
Koed00

Reputation: 671

New in Django 1.8

The --keepdb option can be used to preserve the test database between test runs

https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-option---keepdb

Upvotes: 36

Anton
Anton

Reputation: 976

You can run:

./manage.py testserver

Your test database will be created, all your tests are run and afterwards the server keeps running, so you can do your ui testing.

hope this helps, Anton

Upvotes: 3

lprsd
lprsd

Reputation: 87077

Persistent Database Test Runner adds a new command called quicktest that will retain the database after the test is run, and use the same when run again.

Upvotes: 1

Related Questions