[Zodb-checkins] CVS: ZODB3/ZODB/tests - IteratorStorage.py:1.12.8.2
Barry Warsaw
barry@wooz.org
Mon, 20 Jan 2003 14:18:25 -0500
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv2454
Modified Files:
Tag: ZODB3-3_1-branch
IteratorStorage.py
Log Message:
Backported from trunk:
checkIterationIntraTransaction(): A test for doing iteration while in
the middle of a transaction. This test isn't totally helpful in its
own right, but run it with logging and you'll see the bogus warning
(before the fix is applied).
=== ZODB3/ZODB/tests/IteratorStorage.py 1.12.8.1 => 1.12.8.2 ===
--- ZODB3/ZODB/tests/IteratorStorage.py:1.12.8.1 Wed Dec 18 16:21:09 2002
+++ ZODB3/ZODB/tests/IteratorStorage.py Mon Jan 20 14:18:22 2003
@@ -5,7 +5,7 @@
"""
from ZODB.tests.MinPO import MinPO
-from ZODB.tests.StorageTestBase import zodb_unpickle
+from ZODB.tests.StorageTestBase import zodb_pickle, zodb_unpickle
from ZODB.utils import U64, p64
from ZODB.Transaction import Transaction
@@ -102,6 +102,27 @@
# None in the data attribute.
self.assertEqual(rec.oid, oid)
self.assertEqual(rec.data, None)
+
+ def checkIterationIntraTransaction(self):
+ # XXX try this test with logging enabled. If you see something like
+ #
+ # ZODB FS FS21 warn: FileStorageTests.fs truncated, possibly due to
+ # damaged records at 4
+ #
+ # Then the code in FileIterator.next() hasn't yet been fixed.
+ oid = self._storage.new_oid()
+ t = Transaction()
+ data = zodb_pickle(MinPO(0))
+ try:
+ self._storage.tpc_begin(t)
+ self._storage.store(oid, '\0'*8, data, '', t)
+ self._storage.tpc_vote(t)
+ # Don't do tpc_finish yet
+ it = self._storage.iterator()
+ for x in it:
+ pass
+ finally:
+ self._storage.tpc_finish(t)
class ExtendedIteratorStorage(IteratorCompare):