If you use your tests using the Django ( python manage.py test) test environment , then it will automatically create all the tables for your models in a completely different database, and then populate these tables from your applications, before running the tests. After the tests are completed, the database will be deleted. (If your production database is called foo, the test database will be called foo_test, unless you specify otherwise .)
If you have models that you only need for tests, all you have to do is place your test models in the same directory structure as your test code, instead of mixing with your production models. This ensures that they are not accidentally mixed with your production database.