Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to preserve django test database after running test cases

When I run test cases by typing

python manage.py test myapp

After test cases completed, test databases deleted by default by django test runner. I don't want it to be deleted.

I can use any database!

I want to preserve my database because there are bugs in database that I wanted to see in database that created. So that I can pinpoint them!

like image 970
Bilal Basharat Avatar asked Jan 06 '11 08:01

Bilal Basharat


2 Answers

You can prevent the test databases from being destroyed by using the test --keepdb option.

https://docs.djangoproject.com/en/dev/topics/testing/overview/#the-test-database

like image 128
Tim Babych Avatar answered Nov 08 '22 11:11

Tim Babych


According to the docs, you can preserve the database after running tests by:

$ python manage.py test -k

or

$ python manage.py test --keepdb
like image 32
lmiguelvargasf Avatar answered Nov 08 '22 10:11

lmiguelvargasf