Bilal Basharat Bilal Basharat - 9 months ago 55
Python Question

how to preserve django test database after running test cases

when i run test cases by typing

python 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!

Answer Source

According to docs:

Regardless of whether the tests pass or fail, the test databases aredestroyed 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.