[Zodb-checkins] CVS: ZODB4/src/zodb/storage/tests - test_create.py:1.3

Barry Warsaw barry@wooz.org
Wed, 22 Jan 2003 15:50:27 -0500


Update of /cvs-repository/ZODB4/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv26207

Modified Files:
	test_create.py 
Log Message:
Cleanups and forward ports from ZODB 3.2, such as:

check* -> test*

check the berkeley_is_available flag before attempting to run the BDB
storage tests.


=== ZODB4/src/zodb/storage/tests/test_create.py 1.2 => 1.3 ===
--- ZODB4/src/zodb/storage/tests/test_create.py:1.2	Wed Dec 25 09:12:20 2002
+++ ZODB4/src/zodb/storage/tests/test_create.py	Wed Jan 22 15:50:24 2003
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -12,26 +12,23 @@
 #
 ##############################################################################
 
-try:
-    import bsddb3
-except ImportError:
-    raise RuntimeError, 'BerkeleyDB not available'
-
 # Unit test for database creation
 
 import os
 import time
 import unittest
 
-from zodb.storage.base import BerkeleyConfig
+from zodb.storage.base import BerkeleyConfig, berkeley_is_available
 from zodb.storage.tests import bdbmixin
 from zodb.storage.tests.base import DBHOME
-from zodb.storage.bdbfull import BDBFullStorage
+
+if berkeley_is_available:
+    from zodb.storage.bdbfull import BDBFullStorage
 
 
 
 class TestMixin:
-    def checkDBHomeExists(self):
+    def testDBHomeExists(self):
         self.failUnless(os.path.isdir(DBHOME))
 
 
@@ -45,7 +42,7 @@
 
 
 class FullOpenExistingTest(bdbmixin.FullTestBase):
-    def checkOpenWithExistingVersions(self):
+    def testOpenWithExistingVersions(self):
         version = 'test-version'
         oid = self._storage.new_oid()
         revid = self._dostore(oid, data=7, version=version)
@@ -54,7 +51,7 @@
         self._storage = self.ConcreteStorage(DBHOME)
         self.assertEqual(self._storage.modifiedInVersion(oid), version)
 
-    def checkOpenAddVersion(self):
+    def testOpenAddVersion(self):
         eq = self.assertEqual
         version1 = 'test-version'
         oid1 = self._storage.new_oid()
@@ -77,6 +74,8 @@
 
 
 class FullOpenCloseTest(bdbmixin.FullTestBase):
+    level = 2
+
     def _mk_dbhome(self, dir):
         config = BerkeleyConfig
         config.interval = 10
@@ -87,7 +86,7 @@
             self._zap_dbhome(dir)
             raise
 
-    def checkCloseWithCheckpointingThread(self):
+    def testCloseWithCheckpointingThread(self):
         # All the interesting stuff happens in the setUp and tearDown
         time.sleep(20)
 
@@ -97,7 +96,7 @@
     def _mk_dbhome(self, dir):
         self._dir = dir
 
-    def checkOpenWithBogusConfig(self):
+    def testOpenWithBogusConfig(self):
         class C: pass
         c = C()
         # This instance won't have the necessary attributes, so the creation
@@ -112,11 +111,12 @@
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(MinimalCreateTest, 'check'))
-    suite.addTest(unittest.makeSuite(FullCreateTest, 'check'))
-    suite.addTest(unittest.makeSuite(FullOpenExistingTest, 'check'))
-    suite.addTest(unittest.makeSuite(FullOpenCloseTest, 'check'))
-    suite.addTest(unittest.makeSuite(OpenRecoveryTest, 'check'))
+    if berkeley_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 suite