Friday, October 4, 2013

Copy all the data from an existing database when create the testing database.

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:
  1. 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.)
  2. 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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/15a62df8-ba16-4b73-8e7e-58912a66aee4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate