[Zodb-checkins] CVS: ZODB3/ZODB/tests - testFileStorage.py:1.34.2.2
Jeremy Hylton
cvs-admin at zope.org
Wed Nov 12 00:45:12 EST 2003
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv12458/ZODB/tests
Modified Files:
Tag: ZODB3-mvcc-2-branch
testFileStorage.py
Log Message:
Add glass box test that tickles code in _get_cached_serial().
=== ZODB3/ZODB/tests/testFileStorage.py 1.34.2.1 => 1.34.2.2 ===
--- ZODB3/ZODB/tests/testFileStorage.py:1.34.2.1 Tue Nov 11 17:17:30 2003
+++ ZODB3/ZODB/tests/testFileStorage.py Wed Nov 12 00:45:11 2003
@@ -28,10 +28,23 @@
Synchronization, ConflictResolution, HistoryStorage, \
IteratorStorage, Corruption, RevisionStorage, PersistentStorage, \
MTStorage, ReadOnlyStorage, RecoveryStorage
-from ZODB.tests.StorageTestBase import MinPO, zodb_unpickle
+from ZODB.tests.StorageTestBase import MinPO, zodb_unpickle, zodb_pickle
+
+class BaseFileStorageTests(StorageTestBase.StorageTestBase):
+
+ def open(self, **kwargs):
+ self._storage = ZODB.FileStorage.FileStorage('FileStorageTests.fs',
+ **kwargs)
+
+ def setUp(self):
+ self.open(create=1)
+
+ def tearDown(self):
+ self._storage.close()
+ self._storage.cleanup()
class FileStorageTests(
- StorageTestBase.StorageTestBase,
+ BaseFileStorageTests,
BasicStorage.BasicStorage,
TransactionalUndoStorage.TransactionalUndoStorage,
RevisionStorage.RevisionStorage,
@@ -49,17 +62,6 @@
ReadOnlyStorage.ReadOnlyStorage
):
- def open(self, **kwargs):
- self._storage = ZODB.FileStorage.FileStorage('FileStorageTests.fs',
- **kwargs)
-
- def setUp(self):
- self.open(create=1)
-
- def tearDown(self):
- self._storage.close()
- self._storage.cleanup()
-
def checkLongMetadata(self):
s = "X" * 75000
try:
@@ -170,16 +172,6 @@
self.failUnless(self._storage._records_before_save > 20)
- # There are a bunch of tests that the current pack() implementation
- # does not past. We need to fix pack(), but don't want tests to
- # fail until then.
-
- def checkPackVersionsInPast(self):
- pass
-
- def checkPackAfterUndoDeletion(self):
- pass
-
class FileStorageRecoveryTest(
StorageTestBase.StorageTestBase,
RecoveryStorage.RecoveryStorage,
@@ -198,13 +190,31 @@
def new_dest(self):
return ZODB.FileStorage.FileStorage('Dest.fs')
+class SlowFileStorageTest(BaseFileStorageTests):
+
+ level = 2
+
+ def check10Kstores(self):
+ # The _get_cached_serial() method has a special case
+ # every 8000 calls. Make sure it gets minimal coverage.
+ oids = [[self._storage.new_oid(), None] for i in range(100)]
+ for i in range(100):
+ t = Transaction()
+ self._storage.tpc_begin(t)
+ for j in range(100):
+ o = MinPO(j)
+ oid, revid = oids[j]
+ serial = self._storage.store(oid, revid, zodb_pickle(o), "", t)
+ oids[j][1] = serial
+ self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+
def test_suite():
- suite = unittest.makeSuite(FileStorageTests, 'check')
- suite2 = unittest.makeSuite(Corruption.FileStorageCorruptTests, 'check')
- suite3 = unittest.makeSuite(FileStorageRecoveryTest, 'check')
- suite.addTest(suite2)
- suite.addTest(suite3)
+ suite = unittest.TestSuite()
+ for klass in [FileStorageTests, Corruption.FileStorageCorruptTests,
+ FileStorageRecoveryTest, SlowFileStorageTest]:
+ suite.addTest(unittest.makeSuite(klass, "check"))
return suite
if __name__=='__main__':
More information about the Zodb-checkins
mailing list