I want to be able to use an existing test database to run my tests against and not have Django create and delete a database every time I want to run the tests. Is this possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s possible, here is a way :
1) Define your own test runner look here to see how.
2) For your custom test runner look in the default test runner, you can just copy and past the code and just comment this line :
connection.creation.destroy_test_db(old_name, verbosity)which is responsible for destroying the test database, and i think you should put theconnection.creation.create_test_db(..)line in a try except something like this maybe:3) Bound TEST_RUNNER in setting.py to your test runner.
4) Now run your test like this: ./manage.py test