[Checkins] SVN: ZODB/trunk/src/ZODB/tests/testblob.py Removed a test from the generic storage tests that wasn't actually

Jim Fulton jim at zope.com
Fri Dec 5 18:20:22 EST 2008


Log message for revision 93701:
  Removed a test from the generic storage tests that wasn't actually
  testing a storage. :)
  
  Made it possible to opt out of recovery tests.
  

Changed:
  U   ZODB/trunk/src/ZODB/tests/testblob.py

-=-
Modified: ZODB/trunk/src/ZODB/tests/testblob.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testblob.py	2008-12-05 23:20:20 UTC (rev 93700)
+++ ZODB/trunk/src/ZODB/tests/testblob.py	2008-12-05 23:20:22 UTC (rev 93701)
@@ -95,21 +95,18 @@
                           </zodb>
                           """)
 
-class BlobTestBase(ZODB.tests.StorageTestBase.StorageTestBase):
 
-    def setUp(self):
-        ZODB.tests.StorageTestBase.StorageTestBase.setUp(self)
-        self._storage = self.create_storage()
+class BlobCloneTests(ZODB.tests.util.TestCase):
 
-class BlobCloneTests(BlobTestBase):
-
     def testDeepCopyCanInvalidate(self):
         """
         Tests regression for invalidation problems related to missing
         readers and writers values in cloned objects (see
         http://mail.zope.org/pipermail/zodb-dev/2008-August/012054.html)
         """
-        database = DB(self._storage)
+        import ZODB.MappingStorage
+        database = DB(ZODB.blob.BlobStorage(
+            'blobs', ZODB.MappingStorage.MappingStorage()))
         connection = database.open()
         root = connection.root()
         transaction.begin()
@@ -131,7 +128,13 @@
         # tearDown
         database.close()
 
+class BlobTestBase(ZODB.tests.StorageTestBase.StorageTestBase):
 
+    def setUp(self):
+        ZODB.tests.StorageTestBase.StorageTestBase.setUp(self)
+        self._storage = self.create_storage()
+
+
 class BlobUndoTests(BlobTestBase):
 
     def testUndoWithoutPreviousVersion(self):
@@ -483,8 +486,8 @@
 
     We can access the blob correctly:
 
-    >>> tmpstore.loadBlob(blob_oid, tid) # doctest: +ELLIPSIS
-    '.../0x00/0x00/0x00/0x00/0x00/0x00/0x00/0x01/0x...blob'
+    >>> tmpstore.loadBlob(blob_oid, tid) == blob_storage.loadBlob(blob_oid, tid)
+    True
 
     Clean up:
 
@@ -548,7 +551,9 @@
 
     test.globs['create_storage'] = create_storage
 
-def storage_reusable_suite(prefix, factory):
+def storage_reusable_suite(prefix, factory,
+                           test_blob_storage_recovery=True,
+                           ):
     """Return a test suite for a generic IBlobStorage.
 
     Pass a factory taking a name and a blob directory name.
@@ -583,18 +588,25 @@
             blob_dir = '%s.bobs' % name
         return factory(name, blob_dir)
 
-    for class_ in (BlobCloneTests, BlobUndoTests, RecoveryBlobStorage):
+    def add_test_based_on_test_class(class_):
         new_class = class_.__class__(
             prefix+class_.__name__, (class_, ),
             dict(create_storage=create_storage),
             )
         suite.addTest(unittest.makeSuite(new_class))
 
+    if test_blob_storage_recovery:
+        add_test_based_on_test_class(RecoveryBlobStorage)
+    add_test_based_on_test_class(BlobUndoTests)
+
+    suite.layer = ZODB.tests.util.MininalTestLayer(prefix+'BlobTests')
+
     return suite
 
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(ZODBBlobConfigTest))
+    suite.addTest(unittest.makeSuite(BlobCloneTests))
     suite.addTest(doctest.DocFileSuite(
         "blob_basic.txt",
         "blob_packing.txt", "blob_consume.txt",



More information about the Checkins mailing list