Hi,
When I run my tests, I'd like it to copy an existing database with all the data when create the testing database.
I never thought about this till one of my colleague uses POSTGIS_TEMPLATE = DATABASES['default']['NAME'] for his tests.
Because we use GeoDjango for our project, so POSTGIS_TEMPLATE exists for letting the test runner know which postgis database template to use.
And when he define it as mentioned above, it actually creates the test database with all the data as well. It's kinda handy for us, so we don't need to create the fixture files.
But if we can not do the same with the projects which do not use GeoDjango.
So I have two questions here:
- Is it good idea to use the data already exists in the project database? (For some tests, I may need to delete all the data first for a certain table, but in many cases, we test against non empty data set.)
- If it's not a bad idea, for the project which does not use GeoDjango, is there anyway I can set it to copy the data from the existing database?
Thanks
Tianyi