[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests - testZODB.py:1.9.2.3
Shane Hathaway
shane@zope.com
Tue, 11 Feb 2003 13:52:40 -0500
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv8010/tests
Modified Files:
Tag: shane-conflict-handling-branch
testZODB.py
Log Message:
Fixed the conflicting commit bug. Now, if a read conflict occurs, the
application is not allowed to commit other data. This should make greedy
exception handlers less dangerous.
Also had to correct the test slightly: apparently, failed attempts to
commit result in an implicit transaction abort. This test
needed to be aware of that.
=== Zope/lib/python/ZODB/tests/testZODB.py 1.9.2.2 => 1.9.2.3 ===
--- Zope/lib/python/ZODB/tests/testZODB.py:1.9.2.2 Tue Feb 11 12:29:49 2003
+++ Zope/lib/python/ZODB/tests/testZODB.py Tue Feb 11 13:52:38 2003
@@ -239,13 +239,13 @@
# commit it.
self.assertRaises(ConflictError,
conn2.getTransaction().commit)
- # Verify ZODB continues to refuse it.
- self.assertRaises(ConflictError,
- conn2.getTransaction().commit)
- # Abort the transaction and verify the state of
+ # Verify the transaction was aborted.
+ self.assertNotEqual(real_data2._p_changed, 1)
+ self.assert_(real_data2.has_key('a'))
+
+ # Verify the state of
# the database. Both 'a' and 'b' have the value 'false'.
- conn2.getTransaction().begin()
self.assertEqual(real_data2['a']['indexed_value'], 'false')
self.assertEqual(real_data2['b']['indexed_value'], 'false')
self.assertEqual(len(index2['false']), 2)