Skip to content

Commit 21bf53b

Browse files
committed
Whoosh tests: use a unique tempdir
This ensures that there's no way for results to persist across runs and lets the OS clean up the mess if we fail catastrophically The multiindex and regular whoosh tests will have different prefixes to ease debugging
1 parent b7f6782 commit 21bf53b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/multipleindex_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os
1+
from tempfile import mkdtemp
22
from settings import *
33

44
INSTALLED_APPS += [
@@ -12,7 +12,7 @@
1212
},
1313
'whoosh': {
1414
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
15-
'PATH': os.path.join('tmp', 'test_whoosh_query'),
15+
'PATH': mkdtemp(prefix='haystack-multipleindex-whoosh-tests-'),
1616
'EXCLUDED_INDEXES': ['multipleindex.search_indexes.BarIndex'],
1717
},
1818
}

tests/whoosh_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from tempfile import mkdtemp
12
import os
23
from settings import *
34

@@ -8,8 +9,7 @@
89
HAYSTACK_CONNECTIONS = {
910
'default': {
1011
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
11-
'PATH': os.path.join('tmp', 'test_whoosh_query'),
12+
'PATH': mkdtemp(prefix='haystack-whoosh-tests-'),
1213
'INCLUDE_SPELLING': True,
13-
# 'STORAGE': 'ram',
1414
},
1515
}

0 commit comments

Comments
 (0)