[Zodb-checkins] CVS: Zope/lib/python/BDBStorage/tests - test_zodb_simple.py:1.11 test_whitebox.py:1.6 test_virgin.py:1.13 test_storage_api.py:1.32 test_create.py:1.19 test_autopack.py:1.12 BerkeleyTestBase.py:1.17

Chris Withers chrisw at nipltd.com
Thu Sep 11 14:01:31 EDT 2003


Update of /cvs-repository/Zope/lib/python/BDBStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv15897

Modified Files:
	test_zodb_simple.py test_whitebox.py test_virgin.py 
	test_storage_api.py test_create.py test_autopack.py 
	BerkeleyTestBase.py 
Log Message:
Changes to make BDBStorage tests display a message if they're run when BDBStorage is not available.

=== Zope/lib/python/BDBStorage/tests/test_zodb_simple.py 1.10 => 1.11 ===
--- Zope/lib/python/BDBStorage/tests/test_zodb_simple.py:1.10	Fri Jan  3 17:47:10 2003
+++ Zope/lib/python/BDBStorage/tests/test_zodb_simple.py	Thu Sep 11 13:01:30 2003
@@ -78,13 +78,10 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    if BDBStorage.is_available:
-        suite.addTest(unittest.makeSuite(MinimalCommitAndRead, 'check'))
-        suite.addTest(unittest.makeSuite(FullCommitAndRead, 'check'))
-    return suite
-
-
+    return BDBStorage.tests.BerkeleyTestBase.makeSuite(
+        MinimalCommitAndRead,
+        FullCommitAndRead
+        )    
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')


=== Zope/lib/python/BDBStorage/tests/test_whitebox.py 1.5 => 1.6 ===
--- Zope/lib/python/BDBStorage/tests/test_whitebox.py:1.5	Mon Jan 27 16:18:16 2003
+++ Zope/lib/python/BDBStorage/tests/test_whitebox.py	Thu Sep 11 13:01:30 2003
@@ -246,14 +246,12 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    if BDBStorage.is_available:
-        suite.addTest(unittest.makeSuite(WhiteboxLowLevelMinimal, 'check'))
-        suite.addTest(unittest.makeSuite(WhiteboxHighLevelMinimal, 'check'))
-        suite.addTest(unittest.makeSuite(WhiteboxLowLevelFull, 'check'))
-        suite.addTest(unittest.makeSuite(WhiteboxHighLevelFull, 'check'))
-    return suite
-
+    return BDBStorage.tests.BerkeleyTestBase.makeSuite(
+        WhiteboxLowLevelMinimal,
+        WhiteboxHighLevelMinimal,
+        WhiteboxLowLevelFull,
+        WhiteboxHighLevelFull,
+        )    
 
 
 if __name__ == '__main__':


=== Zope/lib/python/BDBStorage/tests/test_virgin.py 1.12 => 1.13 ===
--- Zope/lib/python/BDBStorage/tests/test_virgin.py:1.12	Fri Jan  3 17:47:10 2003
+++ Zope/lib/python/BDBStorage/tests/test_virgin.py	Thu Sep 11 13:01:30 2003
@@ -46,12 +46,10 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    if BDBStorage.is_available:
-        suite.addTest(unittest.makeSuite(MinimalNewInsertsTest, 'check'))
-        suite.addTest(unittest.makeSuite(FullNewInsertsTest, 'check'))
-    return suite
-
+    return BDBStorage.tests.BerkeleyTestBase.makeSuite(
+        MinimalNewInsertsTest,
+        FullNewInsertsTest,
+        )
 
 
 if __name__ == '__main__':


=== Zope/lib/python/BDBStorage/tests/test_storage_api.py 1.31 => 1.32 ===
--- Zope/lib/python/BDBStorage/tests/test_storage_api.py:1.31	Fri Feb 28 14:48:18 2003
+++ Zope/lib/python/BDBStorage/tests/test_storage_api.py	Thu Sep 11 13:01:30 2003
@@ -77,13 +77,11 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    if BDBStorage.is_available:
-        suite.addTest(unittest.makeSuite(FullTest, 'check'))
-        suite.addTest(unittest.makeSuite(FullRecoveryTest, 'check'))
-        suite.addTest(unittest.makeSuite(MinimalTest, 'check'))
-    return suite
-
+    return BDBStorage.tests.BerkeleyTestBase.makeSuite(
+        FullTest,
+        FullRecoveryTest,
+        MinimalTest,
+        )
 
 
 if __name__ == '__main__':


=== Zope/lib/python/BDBStorage/tests/test_create.py 1.18 => 1.19 ===
--- Zope/lib/python/BDBStorage/tests/test_create.py:1.18	Mon Jan 27 16:19:27 2003
+++ Zope/lib/python/BDBStorage/tests/test_create.py	Thu Sep 11 13:01:30 2003
@@ -111,13 +111,14 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    if BDBStorage.is_available:
-        suite.addTest(unittest.makeSuite(MinimalCreateTest))
-        suite.addTest(unittest.makeSuite(FullCreateTest))
-        suite.addTest(unittest.makeSuite(FullOpenExistingTest))
-        suite.addTest(unittest.makeSuite(FullOpenCloseTest))
-        suite.addTest(unittest.makeSuite(OpenRecoveryTest))
+    return BDBStorage.tests.BerkeleyTestBase.makeSuite(
+        MinimalCreateTest,
+        FullCreateTest,
+        FullOpenExistingTest,
+        FullOpenCloseTest,
+        OpenRecoveryTest,
+        prefix='test'
+        )
     return suite
 
 


=== Zope/lib/python/BDBStorage/tests/test_autopack.py 1.11 => 1.12 ===
--- Zope/lib/python/BDBStorage/tests/test_autopack.py:1.11	Fri May 23 17:25:04 2003
+++ Zope/lib/python/BDBStorage/tests/test_autopack.py	Thu Sep 11 13:01:30 2003
@@ -533,16 +533,15 @@
 
 
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.level = 2
-    if BDBStorage.is_available:
-        suite.addTest(unittest.makeSuite(TestAutopack))
-        suite.addTest(unittest.makeSuite(TestAutomaticClassicPack))
-        suite.addTest(unittest.makeSuite(TestMinimalPack))
-        suite.addTest(unittest.makeSuite(TestFullClassicPackRaceCondition))
-        suite.addTest(unittest.makeSuite(TestMinimalClassicPackRaceCondition))
-    return suite
-
+    return BDBStorage.tests.BerkeleyTestBase.makeSuite(
+        TestAutopack,
+        TestAutomaticClassicPack,
+        TestMinimalPack,
+        TestFullClassicPackRaceCondition,
+        TestMinimalClassicPackRaceCondition,
+        prefix='test',
+        level=2
+        )
 
 
 if __name__ == '__main__':


=== Zope/lib/python/BDBStorage/tests/BerkeleyTestBase.py 1.16 => 1.17 ===
--- Zope/lib/python/BDBStorage/tests/BerkeleyTestBase.py:1.16	Thu Jul 24 11:57:39 2003
+++ Zope/lib/python/BDBStorage/tests/BerkeleyTestBase.py	Thu Sep 11 13:01:30 2003
@@ -18,7 +18,10 @@
 import os
 import errno
 import shutil
+import sys
+import unittest
 
+import BDBStorage
 from BDBStorage.BerkeleyBase import BerkeleyConfig
 from ZODB.tests.StorageTestBase import StorageTestBase
 
@@ -77,3 +80,18 @@
 class FullTestBase(BerkeleyTestBase):
     from BDBStorage import BDBFullStorage
     ConcreteStorage = BDBFullStorage.BDBFullStorage
+
+def makeSuite(*args,**kw):
+    prefix = kw.get('prefix','check')
+    level = kw.get('level')
+    suite = unittest.TestSuite()
+    if level:
+        suite.level = level
+    if BDBStorage.is_available:
+        for klass in args:
+            suite.addTest(unittest.makeSuite(klass, prefix))
+    else:
+        sys.stderr.write("BDBStorage not available, tests disabled\n")
+        
+    return suite
+    




More information about the Zodb-checkins mailing list