diff --git a/test/test_db.py b/test/test_db.py
index 33bc69caee2492bd67798394328bb1cb8f4bccae..315ab2fd3e71bd55bc39fe8c24b2c59513f3c6e0 100644 (file)
--- a/test/test_db.py
+++ b/test/test_db.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: test_db.py,v 1.53 2002-09-20 19:26:28 gmcm Exp $
+# $Id: test_db.py,v 1.55 2002-09-24 01:59:44 richard Exp $
import unittest, os, shutil, time
import unittest, os, shutil, time
(x, date_stamp2, x, x, x) = entry
# see if the change was journalled when it shouldn't have been
self.assertEqual(date_stamp, date_stamp2)
(x, date_stamp2, x, x, x) = entry
# see if the change was journalled when it shouldn't have been
self.assertEqual(date_stamp, date_stamp2)
+ time.sleep(1)
self.db.issue.enableJournalling()
self.db.issue.set('1', title='hello world 2')
self.db.commit()
self.db.issue.enableJournalling()
self.db.issue.set('1', title='hello world 2')
self.db.commit()
self.db.commit()
# sleep for at least a second, then get a date to pack at
self.db.commit()
# sleep for at least a second, then get a date to pack at
- time.sleep(1)
+ time.sleep(2)
pack_before = date.Date('.')
pack_before = date.Date('.')
- time.sleep(1)
+ time.sleep(2)
# one more entry
self.db.issue.set(id, status='3')
# one more entry
self.db.issue.set(id, status='3')
self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
{'1': {}})
self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
{'1': {}})
+ def testStringFind(self):
+ ids = []
+ ids.append(self.db.issue.create(title="spam"))
+ self.db.issue.create(title="not spam")
+ ids.append(self.db.issue.create(title="spam"))
+ ids.sort()
+ got = self.db.issue.stringFind(title='spam')
+ got.sort()
+ self.assertEqual(got, ids)
+ self.assertEqual(self.db.issue.stringFind(title='fubar'), [])
+
def filteringSetup(self):
for user in (
{'username': 'bleep'},
def filteringSetup(self):
for user in (
{'username': 'bleep'},
]
# return unittest.TestSuite(l)
]
# return unittest.TestSuite(l)
- try:
- import gadfly
+ from roundup import backends
+ if hasattr(backends, 'gadfly'):
l.append(unittest.makeSuite(gadflyDBTestCase, 'test'))
l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test'))
l.append(unittest.makeSuite(gadflyDBTestCase, 'test'))
l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test'))
- except:
- print 'gadfly module not found, skipping gadfly DBTestCase'
- try:
- import sqlite
+ if hasattr(backends, 'sqlite'):
l.append(unittest.makeSuite(sqliteDBTestCase, 'test'))
l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test'))
l.append(unittest.makeSuite(sqliteDBTestCase, 'test'))
l.append(unittest.makeSuite(sqliteReadOnlyDBTestCase, 'test'))
- except:
- print 'sqlite module not found, skipping gadfly DBTestCase'
- try:
- import bsddb
+ if hasattr(backends, 'bsddb'):
l.append(unittest.makeSuite(bsddbDBTestCase, 'test'))
l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test'))
l.append(unittest.makeSuite(bsddbDBTestCase, 'test'))
l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test'))
- except:
- print 'bsddb module not found, skipping bsddb DBTestCase'
- try:
- import bsddb3
+ if hasattr(backends, 'bsddb3'):
l.append(unittest.makeSuite(bsddb3DBTestCase, 'test'))
l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test'))
l.append(unittest.makeSuite(bsddb3DBTestCase, 'test'))
l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test'))
- except:
- print 'bsddb3 module not found, skipping bsddb3 DBTestCase'
- try:
- import metakit
+ if hasattr(backends, 'metakit'):
l.append(unittest.makeSuite(metakitDBTestCase, 'test'))
l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test'))
l.append(unittest.makeSuite(metakitDBTestCase, 'test'))
l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test'))
- except:
- print 'metakit module not found, skipping metakit DBTestCase'
return unittest.TestSuite(l)
return unittest.TestSuite(l)