[Zope-Checkins] CVS: Zope/lib/python/ZODB/tests - ReadOnlyStorage.py:1.2.6.1 testFileStorage.py:1.13.32.2
Matthew T. Kromer
matt@zope.com
Thu, 21 Feb 2002 11:01:09 -0500
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv18362/lib/python/ZODB/tests
Modified Files:
Tag: Zope-2_5-branch
testFileStorage.py
Added Files:
Tag: Zope-2_5-branch
ReadOnlyStorage.py
Log Message:
Add ReadOnlyFileStorage (not added from StandaloneZODB tests)
Comment out suite3 test in testFileStorage (undefined)
=== Added File Zope/lib/python/ZODB/tests/ReadOnlyStorage.py ===
from ZODB.POSException import ReadOnlyError
from ZODB.Transaction import Transaction
class ReadOnlyStorage:
def _create_data(self):
# test a read-only storage that already has some data
self.oids = {}
for i in range(10):
oid = self._storage.new_oid()
revid = self._dostore(oid)
self.oids[oid] = revid
def _make_readonly(self):
self._storage.close()
self.open(read_only=1)
self.assert_(self._storage.isReadOnly())
def checkReadMethods(self):
self._create_data()
self._make_readonly()
# XXX not going to bother checking all read methods
for oid in self.oids.keys():
data, revid = self._storage.load(oid, '')
self.assertEqual(revid, self.oids[oid])
self.assert_(not self._storage.modifiedInVersion(oid))
_data = self._storage.loadSerial(oid, revid)
self.assertEqual(data, _data)
def checkWriteMethods(self):
self._make_readonly()
self.assertRaises(ReadOnlyError, self._storage.new_oid)
self.assertRaises(ReadOnlyError, self._storage.undo,
'\000' * 8)
t = Transaction()
self._storage.tpc_begin(t)
self.assertRaises(ReadOnlyError, self._storage.abortVersion,
'', t)
self._storage.tpc_abort(t)
t = Transaction()
self._storage.tpc_begin(t)
self.assertRaises(ReadOnlyError, self._storage.commitVersion,
'', '', t)
self._storage.tpc_abort(t)
t = Transaction()
self._storage.tpc_begin(t)
self.assertRaises(ReadOnlyError, self._storage.store,
'\000' * 8, None, '', '', t)
self._storage.tpc_abort(t)
if self._storage.supportsTransactionalUndo():
t = Transaction()
self._storage.tpc_begin(t)
self.assertRaises(ReadOnlyError, self._storage.transactionalUndo,
'\000' * 8, t)
self._storage.tpc_abort(t)
=== Zope/lib/python/ZODB/tests/testFileStorage.py 1.13.32.1 => 1.13.32.2 ===
suite2 = unittest.makeSuite(Corruption.FileStorageCorruptTests, 'check')
suite.addTest(suite2)
- suite.addTest(suite3)
+ #suite.addTest(suite3)
return suite
def main():