Skip to content

Commit b27aeda

Browse files
author
Richard Jones
committed
try to make unit test here more robust
1 parent c809be8 commit b27aeda

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/test_db.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: test_db.py,v 1.63.2.1 2003-02-27 11:21:04 richard Exp $
18+
# $Id: test_db.py,v 1.63.2.2 2003-03-18 00:43:29 richard Exp $
1919

2020
import unittest, os, shutil, time
2121

@@ -494,12 +494,13 @@ def testPack(self):
494494
self.db.issue.set(id, status='2')
495495
self.db.commit()
496496

497-
# sleep for at least a second, then get a date to pack at
498-
time.sleep(1)
497+
# sleep for at least a second (packing granularity), then get a
498+
# date to pack at
499+
time.sleep(2)
499500
pack_before = date.Date('.')
500501

501-
# wait another second and add one more entry
502-
time.sleep(1)
502+
# wait for at least another second and add one more entry
503+
time.sleep(2)
503504
self.db.issue.set(id, status='3')
504505
self.db.commit()
505506
jlen = len(self.db.getjournal('issue', id))
@@ -817,12 +818,18 @@ def setUp(self):
817818

818819
def suite():
819820
l = [
820-
unittest.makeSuite(anydbmDBTestCase, 'test'),
821-
unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test')
821+
# unittest.makeSuite(anydbmDBTestCase, 'test'),
822+
# unittest.makeSuite(anydbmReadOnlyDBTestCase, 'test')
822823
]
823824
# return unittest.TestSuite(l)
824825

825826
from roundup import backends
827+
828+
if hasattr(backends, 'bsddb3'):
829+
l.append(unittest.makeSuite(bsddb3DBTestCase, 'test'))
830+
l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test'))
831+
return unittest.TestSuite(l)
832+
826833
if hasattr(backends, 'gadfly'):
827834
l.append(unittest.makeSuite(gadflyDBTestCase, 'test'))
828835
l.append(unittest.makeSuite(gadflyReadOnlyDBTestCase, 'test'))
@@ -835,10 +842,6 @@ def suite():
835842
l.append(unittest.makeSuite(bsddbDBTestCase, 'test'))
836843
l.append(unittest.makeSuite(bsddbReadOnlyDBTestCase, 'test'))
837844

838-
if hasattr(backends, 'bsddb3'):
839-
l.append(unittest.makeSuite(bsddb3DBTestCase, 'test'))
840-
l.append(unittest.makeSuite(bsddb3ReadOnlyDBTestCase, 'test'))
841-
842845
if hasattr(backends, 'metakit'):
843846
l.append(unittest.makeSuite(metakitDBTestCase, 'test'))
844847
l.append(unittest.makeSuite(metakitReadOnlyDBTestCase, 'test'))

0 commit comments

Comments
 (0)