[Answered ]-Testing django app with legacy database – how to avoid recreating db per test?

2👍

After some re-googling (first attempt was several weeks ago and just couldn’t find this, because it appeared a month ago) I’ve found this topic, which leads me to django-test-utils; persistent database test runner (e.g. python manage.py quicktest) solves my case (in addition, it seems to be good app in general). In addition, I had to tweak TEST_DATABASE_NAME option in settings.py to my main database to fit my needs.

👤gorsky

0👍

This doesn’t give you the behavior you’re asking for, just a potential alternate behavior:

While I deploy and run integration tests against my actual legacy database, I run unit tests against a SQLite database. It’s a small configuration change switching the DB engine to get it working. It ends up being faster and avoids clobbering any other work I’m doing.

Leave a comment