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 October 2013 17:08:02 UTC+1, C. Kirby wrote:
>
> 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 UTC-5, Tianyi Wang wrote:
>>
>> 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+unsubscr...@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/1fa6f2fb-cc01-4b46-9c78-02d3e5347032%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to