Search code examples
pythondjangosatchmo

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!


Solution

  • According to docs:

    Regardless of whether the tests pass or fail, the test databases are destroyed when all the tests have been executed.

    Although, fixtures might be a help in your situation. Just create initial data, you want to be there when test starts, as texture, and make test load it.