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

2013-10-04 Thread Tianyi Wang
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_TEM

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

2013-10-04 Thread C. Kirby
Do you always want all of the data from the existing database, or is this just a quick way to have "real data" for testing. If it is the latter I would use manage.py dumpdata to generate test fixtures. You can load the fixtures in you tests as needed. Chaim On Friday, October 4, 2013 8:48:45 AM

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

2013-10-04 Thread Tianyi Wang
Yes, it'd be nice to have all the data from the existing database. I am aware the loading fixtures way, but I will need to do that every time I know the existing database has changed a lot. So just copy the data when creating the test database seems more convenient. Tianyi On Friday, 4 Octobe

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

2013-10-05 Thread Kelvin Wong
Consider using model factories (you can roll your own) or FactoryBoy https://factoryboy.readthedocs.org/en/latest/ K On Friday, October 4, 2013 9:17:51 AM UTC-7, Tianyi Wang wrote: > > Yes, it'd be nice to have all the data from the existing database. > I am aware the loading fixtures way, but

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

2013-10-07 Thread Tianyi Wang
Thanks Kelvin, I will have a look at this. It seems interesting. Kelvin Wong writes: > Consider using model factories (you can roll your own) or FactoryBoy > > https://factoryboy.readthedocs.org/en/latest/ > > K > > > On Friday, October 4, 2013 9:17:51 AM UTC-7, Tianyi Wang wrote: >> >> Yes, it'd