Wednesday, August 4, 2010

Re: multi_db support for doctests? How to enable?

Hi,

The second database should be created. Maybe you want to double check you setup a database router.
You also want to take care to fixture file name which expects you to add the database name in the file name.

So far, the only issue I found with testing on multi database is that django 1.2 expects all the tables are created on the second database which may not always be the case (bug reported, I just uploaded a patch for that).

Regards,
Xavier.

Le 4 août 2010 à 17:55, Reinout van Rees a écrit :

> On 08/04/2010 01:49 PM, Russell Keith-Magee wrote:
>>
>> Doctests don't do any database flushing, so there is no analog for the
>> multi-db flag. Just make your calls on the database as you normally
>> would.
>
> Ah, ok.
>
> Then I'm doing something else wrong (I've only got doctests right now): my second database isn't created by the test mechanism. I added a regular unittest with the multi_db=True, but that also didn't result in a second database.
>
> The code *does* use the regular database (sqlite, if available), but it doesn't create a test database like it does for the default database.
>
> The relevant part from my testsettings.py:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.contrib.gis.db.backends.spatialite',
> 'NAME': 'test.db',
> },
> 'fews-unblobbed': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': 'testunblobbed.db',
> }
> }
>
> No special options, I'd say. The test database *used* to get created when I last ran the tests a few weeks ago, now that I think about it. I'll have to do some more debugging.
>
>
> Reinout
>
>
> --
> Reinout van Rees - reinout@vanrees.org - http://reinout.vanrees.org
> Programmer at http://www.nelen-schuurmans.nl
> "Military engineers build missiles. Civil engineers build targets"
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment