[Zope-Checkins] CVS: Zope/lib/python/ZODB/tests - testZODB.py:1.9.2.2
Shane Hathaway
shane@zope.com
Tue, 11 Feb 2003 12:29:50 -0500
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv24083
Modified Files:
Tag: shane-conflict-handling-branch
testZODB.py
Log Message:
Simplified the test.
=== Zope/lib/python/ZODB/tests/testZODB.py 1.9.2.1 => 1.9.2.2 ===
--- Zope/lib/python/ZODB/tests/testZODB.py:1.9.2.1 Tue Feb 11 12:01:10 2003
+++ Zope/lib/python/ZODB/tests/testZODB.py Tue Feb 11 12:29:49 2003
@@ -211,27 +211,25 @@
index['false']['b'] = 1
get_transaction().commit()
- # now try to change the 'a' value in a simultaneous
+ # now remove the 'a' value in a simultaneous
# transaction. The data itself will not conflict,
# but the index will.
- real_data2['a']['indexed_value'] = 'true'
+ del real_data2['a']
try:
del index2['false']['a']
- index2['true']['a'] = 1
- except:
- # This bare except clause is intentional.
- # The purpose of this test is to verify ZODB doesn't
- # commit conflicting transactions even though bare
- # except clauses are present in application code.
+ except ConflictError:
+ # This is expected. Catch the exception and ignore
+ # it, intentionally leaving the index in a
+ # state inconsistent with the data.
pass
+ else:
+ self.fail("No conflict occurred")
- # Precondition: real_data2['a'] is still ready to commit.
- self.assertEqual(real_data2['a']['indexed_value'], 'true')
- self.assertEqual(real_data2['a']._p_changed, 1)
+ # Precondition: real_data2 is still ready to commit.
+ self.assertEqual(real_data2._p_changed, 1)
# Precondition: index2 values are *not* ready to commit.
- # (In fact, they are probably ghosted.)
self.assertNotEqual(index2._p_changed, 1)
self.assertNotEqual(index2['false']._p_changed, 1)
self.assertNotEqual(index2['true']._p_changed, 1)