Commit 4aa0781b authored by Jim Fulton's avatar Jim Fulton

Removed a test from the generic storage tests that wasn't actually

testing a storage. :)

Made it possible to opt out of recovery tests.
parent 3f1d4317
...@@ -95,13 +95,8 @@ class ZODBBlobConfigTest(ConfigTestBase): ...@@ -95,13 +95,8 @@ class ZODBBlobConfigTest(ConfigTestBase):
</zodb> </zodb>
""") """)
class BlobTestBase(ZODB.tests.StorageTestBase.StorageTestBase):
def setUp(self):
ZODB.tests.StorageTestBase.StorageTestBase.setUp(self)
self._storage = self.create_storage()
class BlobCloneTests(BlobTestBase): class BlobCloneTests(ZODB.tests.util.TestCase):
def testDeepCopyCanInvalidate(self): def testDeepCopyCanInvalidate(self):
""" """
...@@ -109,7 +104,9 @@ class BlobCloneTests(BlobTestBase): ...@@ -109,7 +104,9 @@ class BlobCloneTests(BlobTestBase):
readers and writers values in cloned objects (see readers and writers values in cloned objects (see
http://mail.zope.org/pipermail/zodb-dev/2008-August/012054.html) 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() connection = database.open()
root = connection.root() root = connection.root()
transaction.begin() transaction.begin()
...@@ -131,6 +128,12 @@ class BlobCloneTests(BlobTestBase): ...@@ -131,6 +128,12 @@ class BlobCloneTests(BlobTestBase):
# tearDown # tearDown
database.close() 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): class BlobUndoTests(BlobTestBase):
...@@ -483,8 +486,8 @@ def loadblob_tmpstore(): ...@@ -483,8 +486,8 @@ def loadblob_tmpstore():
We can access the blob correctly: We can access the blob correctly:
>>> tmpstore.loadBlob(blob_oid, tid) # doctest: +ELLIPSIS >>> tmpstore.loadBlob(blob_oid, tid) == blob_storage.loadBlob(blob_oid, tid)
'.../0x00/0x00/0x00/0x00/0x00/0x00/0x00/0x01/0x...blob' True
Clean up: Clean up:
...@@ -548,7 +551,9 @@ def setUpBlobAdaptedFileStorage(test): ...@@ -548,7 +551,9 @@ def setUpBlobAdaptedFileStorage(test):
test.globs['create_storage'] = create_storage 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. """Return a test suite for a generic IBlobStorage.
Pass a factory taking a name and a blob directory name. Pass a factory taking a name and a blob directory name.
...@@ -583,18 +588,25 @@ def storage_reusable_suite(prefix, factory): ...@@ -583,18 +588,25 @@ def storage_reusable_suite(prefix, factory):
blob_dir = '%s.bobs' % name blob_dir = '%s.bobs' % name
return factory(name, blob_dir) return factory(name, blob_dir)
for class_ in (BlobCloneTests, BlobUndoTests, RecoveryBlobStorage): def add_test_based_on_test_class(class_):
new_class = class_.__class__( new_class = class_.__class__(
prefix+class_.__name__, (class_, ), prefix+class_.__name__, (class_, ),
dict(create_storage=create_storage), dict(create_storage=create_storage),
) )
suite.addTest(unittest.makeSuite(new_class)) 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 return suite
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(ZODBBlobConfigTest)) suite.addTest(unittest.makeSuite(ZODBBlobConfigTest))
suite.addTest(unittest.makeSuite(BlobCloneTests))
suite.addTest(doctest.DocFileSuite( suite.addTest(doctest.DocFileSuite(
"blob_basic.txt", "blob_basic.txt",
"blob_packing.txt", "blob_consume.txt", "blob_packing.txt", "blob_consume.txt",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment