[Zodb-checkins] CVS: ZODB4/BDBStorage/tests - test_create.py:1.15

Barry Warsaw barry@wooz.org
Fri, 6 Dec 2002 15:42:45 -0500


Update of /cvs-repository/ZODB4/BDBStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv29000/BDBStorage/tests

Modified Files:
	test_create.py 
Log Message:
Port OpenRecoveryTest from ZODB3


=== ZODB4/BDBStorage/tests/test_create.py 1.14 => 1.15 ===
--- ZODB4/BDBStorage/tests/test_create.py:1.14	Wed Dec  4 12:19:56 2002
+++ ZODB4/BDBStorage/tests/test_create.py	Fri Dec  6 15:42:45 2002
@@ -17,8 +17,10 @@
 import os
 import time
 import unittest
-import BerkeleyTestBase
+
 from BDBStorage.BerkeleyBase import BerkeleyConfig
+from BDBStorage.tests import BerkeleyTestBase
+from BDBStorage.BDBFullStorage import BDBFullStorage
 
 
 
@@ -85,12 +87,30 @@
 
 
 
+class OpenRecoveryTest(BerkeleyTestBase.FullTestBase):
+    def _mk_dbhome(self, dir):
+        self._dir = dir
+
+    def checkOpenWithBogusConfig(self):
+        class C: pass
+        c = C()
+        # This instance won't have the necessary attributes, so the creation
+        # will fail.  We want to be sure that everything gets cleaned up
+        # enough to fix that and create a proper storage.
+        self.assertRaises(AttributeError, BDBFullStorage, self._dir, config=c)
+        c = BerkeleyConfig()
+        s = BDBFullStorage(self._dir, config=c)
+        s.close()
+
+
+
 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'))
     return suite