Skip to content

Commit a3eac0f

Browse files
committed
Change method for settin indexer; have test_livetest for pg cleanup
Add code to defer opening the indexer only if indexer is native-fts. See if this fixes the sqlite OperationalError. Also under python 2.7 (only), the db from test_livetracker when using postgres FTS didn't empty the db. This caused the following test_postgres.py test to fail. Why it only showed up on 2.7 and not any of the 3.x releases is a mystery.
1 parent 5e57b9f commit a3eac0f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

roundup/backends/rdbms_common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ def __init__(self, config, journaltag=None):
188188
# requires a database connection (conn) to be defined when
189189
# calling get_indexer. The call to open_connection creates the
190190
# conn but also creates the schema if it is missing.
191-
self.indexer = CommonIndexer(self)
191+
if self.config['INDEXER'] != 'native-fts':
192+
self.indexer = get_indexer(config, self)
193+
else:
194+
self.indexer = CommonIndexer(self)
192195
self.security = security.Security(self)
193196

194197
# additional transaction support for external files and the like
@@ -217,7 +220,8 @@ def __init__(self, config, journaltag=None):
217220

218221
# If indexer is native-fts, conn to db must be available.
219222
# so we set the real self.indexer value here, after db is open.
220-
self.indexer = get_indexer(config, self)
223+
if self.config['INDEXER'] == 'native-fts':
224+
self.indexer = get_indexer(config, self)
221225

222226
def clearCache(self):
223227
self.cache = {}

test/test_liveserver.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,11 @@ def setup_class(cls):
11831183
i18n.LOCALE_DIRS = ['locale']
11841184
i18n.DOMAIN = ''
11851185

1186+
@classmethod
1187+
def tearDownClass(cls):
1188+
# cleanup
1189+
cls.instance.backend.db_nuke(cls.db.config)
1190+
11861191
def test_native_fts(self):
11871192
self.assertIn("postgresql_fts", str(self.db.indexer))
11881193

0 commit comments

Comments
 (0)