toastdriven/django-haystack — Issue #497: Use a different connection when running tests
Author: qris
Created: 2012-02-03 20:24:52+00:00
State: open

Just as Django uses a different database when running tests, to avoid interfering with the developer's working database, it would seem to make sense to provide a database for tests.

For example, I can do this in my tests:

```
settings.HAYSTACK_CONNECTIONS[DEFAULT_ALIAS]['PATH'] = '/dev/shm/whoosh'
from haystack import connections
connections[DEFAULT_ALIAS].get_backend().delete_index()
```

Is that the right way to do it? (apart from /dev/shm not being portable).

It would be great if Whoosh did something like this automatically if you have a 'test' connection defined.