[Zodb-checkins] CVS: Packages/bsddb3Storage - test_create.py:1.7
barry@digicool.com
barry@digicool.com
Wed, 11 Apr 2001 18:14:20 -0400 (EDT)
Update of /cvs-repository/Packages/bsddb3Storage/test
In directory korak:/tmp/cvs-serv10025/test
Modified Files:
test_create.py
Log Message:
Simplified and reorganized to use mixin style testing.
BaseFramework, MinimalBaseFrameWork, FullBaseFramework classes
removed.
MinimalDBHomeTest => MinimalCreateTest, and mixin inheritance
FullDBHomeTest => FullCreateTest, and mixin inheritance
suite(): use unittest.makeSuite()
--- Updated File test_create.py in package Packages/bsddb3Storage --
--- test_create.py 2001/04/05 21:16:51 1.6
+++ test_create.py 2001/04/11 22:14:19 1.7
@@ -1,71 +1,33 @@
# Unit test for database creation
import os
-import errno
import unittest
+import BerkeleyTestBase
-class BaseFramework(unittest.TestCase):
- def setUp(self):
- from ZODB import DB
-
- self._dbhome = 'test-db'
- os.mkdir(self._dbhome)
-
- try:
- self._storage = self.ConcreteStorage(self._dbhome)
- self._db = DB(self._storage)
- self._conn = self._db.open()
- self._root = self._conn.root()
- except:
- self.tearDown()
- raise
-
- def _close(self):
- self._db.close()
-
- def tearDown(self):
- # If the tests exited with any uncommitted objects, they'll blow up
- # subsequent tests because the next transaction commit will try to
- # commit those object. But they're tied to closed databases, so
- # that's broken. Aborting the transaction now saves us the headache.
- get_transaction().abort()
- self._close()
- for file in os.listdir(self._dbhome):
- os.unlink(os.path.join(self._dbhome, file))
- os.removedirs(self._dbhome)
-
-
class TestMixin:
def checkDBHomeExists(self):
- assert os.path.isdir(self._dbhome)
-
-
-
-class MinimalBaseFramework(BaseFramework):
- import Minimal
- ConcreteStorage = Minimal.Minimal
+ assert os.path.isdir(BerkeleyTestBase.DBHOME)
-class MinimalDBHomeTest(MinimalBaseFramework, TestMixin):
+class MinimalCreateTest(BerkeleyTestBase.BerkeleyTestBase,
+ BerkeleyTestBase.MinimalTestBase,
+ TestMixin):
pass
-
-
-class FullBaseFramework(BaseFramework):
- import Full
- ConcreteStorage = Full.Full
-class FullDBHomeTest(FullBaseFramework, TestMixin):
+class FullCreateTest(BerkeleyTestBase.BerkeleyTestBase,
+ BerkeleyTestBase.FullTestBase,
+ TestMixin):
pass
def suite():
suite = unittest.TestSuite()
- suite.addTest(MinimalDBHomeTest('checkDBHomeExists'))
- suite.addTest(FullDBHomeTest('checkDBHomeExists'))
+ suite.addTest(unittest.makeSuite(MinimalCreateTest, 'check'))
+ suite.addTest(unittest.makeSuite(FullCreateTest, 'check'))
return suite