|
1 | 1 | import datetime
|
2 |
| - |
3 |
| -from mock import patch |
4 |
| -import pysolr |
5 | 2 | from tempfile import mkdtemp
|
6 | 3 |
|
| 4 | +import pysolr |
7 | 5 | from django import VERSION as DJANGO_VERSION
|
8 | 6 | from django.conf import settings
|
9 | 7 | from django.core.exceptions import ImproperlyConfigured
|
10 | 8 | from django.core.management import call_command
|
11 | 9 | from django.test import TestCase
|
12 | 10 | from django.utils import unittest
|
| 11 | +from mock import patch |
13 | 12 |
|
14 |
| -from haystack import connections |
15 |
| -from haystack import indexes |
| 13 | +from haystack import connections, indexes |
16 | 14 | from haystack.utils.loading import UnifiedIndex
|
17 | 15 |
|
18 | 16 | from ..core.models import MockModel, MockTag
|
@@ -145,13 +143,11 @@ def test_multiprocessing(self):
|
145 | 143 | call_command('update_index', verbosity=2, workers=2, batchsize=5)
|
146 | 144 | self.assertEqual(self.solr.search('*:*').hits, 23)
|
147 | 145 |
|
| 146 | + @patch.dict(settings.HAYSTACK_CONNECTIONS['whoosh'], {'PATH': mkdtemp(prefix='dummy-path-')}) |
148 | 147 | def test_build_schema_wrong_backend(self):
|
149 |
| - |
150 |
| - settings.HAYSTACK_CONNECTIONS['whoosh'] = {'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', |
151 |
| - 'PATH': mkdtemp(prefix='dummy-path-'),} |
152 |
| - |
153 | 148 | connections['whoosh']._index = self.ui
|
154 |
| - self.assertRaises(ImproperlyConfigured, call_command, 'build_solr_schema',using='whoosh', interactive=False) |
| 149 | + self.assertRaises(ImproperlyConfigured, call_command, 'build_solr_schema', using='whoosh', |
| 150 | + interactive=False) |
155 | 151 |
|
156 | 152 | class AppModelManagementCommandTestCase(TestCase):
|
157 | 153 | fixtures = ['bulk_data.json']
|
|
0 commit comments