changeset 6918:cb2ed1e8c852

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.
author John Rouillard <rouilj@ieee.org>
date Tue, 06 Sep 2022 14:43:36 -0400
parents fba76e0bba98
children 4076c5cfd682
files roundup/backends/rdbms_common.py test/test_liveserver.py
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Tue Sep 06 11:32:13 2022 -0400
+++ b/roundup/backends/rdbms_common.py	Tue Sep 06 14:43:36 2022 -0400
@@ -188,7 +188,10 @@
         # requires a database connection (conn) to be defined when
         # calling get_indexer.  The call to open_connection creates the
         # conn but also creates the schema if it is missing.
-        self.indexer = CommonIndexer(self)
+        if self.config['INDEXER'] != 'native-fts':
+            self.indexer = get_indexer(config, self)
+        else:
+            self.indexer = CommonIndexer(self)
         self.security = security.Security(self)
 
         # additional transaction support for external files and the like
@@ -217,7 +220,8 @@
 
         # If indexer is native-fts, conn to db must be available.
         # so we set the real self.indexer value here, after db is open.
-        self.indexer = get_indexer(config, self)
+        if self.config['INDEXER'] == 'native-fts':
+            self.indexer = get_indexer(config, self)
 
     def clearCache(self):
         self.cache = {}
--- a/test/test_liveserver.py	Tue Sep 06 11:32:13 2022 -0400
+++ b/test/test_liveserver.py	Tue Sep 06 14:43:36 2022 -0400
@@ -1183,6 +1183,11 @@
         i18n.LOCALE_DIRS = ['locale']
         i18n.DOMAIN = ''
 
+    @classmethod
+    def tearDownClass(cls):
+        # cleanup
+        cls.instance.backend.db_nuke(cls.db.config)
+
     def test_native_fts(self):
         self.assertIn("postgresql_fts", str(self.db.indexer))
 

Roundup Issue Tracker: http://roundup-tracker.org/