[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - teststorage.py:1.10
Shane Hathaway
shane at zope.com
Thu Mar 25 23:01:10 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv461/lib/apelib/tests
Modified Files:
teststorage.py
Log Message:
Made conflict debugging a ZConfig option.
It is useful to turn on when writing gateways.
=== Products/Ape/lib/apelib/tests/teststorage.py 1.9 => 1.10 ===
--- Products/Ape/lib/apelib/tests/teststorage.py:1.9 Sat Mar 20 01:34:24 2004
+++ Products/Ape/lib/apelib/tests/teststorage.py Thu Mar 25 23:01:09 2004
@@ -221,11 +221,32 @@
ob1 = self._write_basic_object(conn1)
ob1.strdata = 'def'
run_in_thread(self._change_test_root)
+ # Don't let the Connection generate the conflict. This is
+ # a test of the storage.
+ conn1._invalidated.clear()
# Verify that "def" doesn't get written, since it
# conflicts with "ghi".
self.assertRaises(ZODB.POSException.ConflictError,
get_transaction().commit)
self.assertEqual(ob1.strdata, "ghi")
+ finally:
+ conn1.close()
+
+
+ def test_debug_conflict_errors(self):
+ # When debug_conflicts is on, ApeStorage generates a
+ # RuntimeError with information instead of a simple
+ # ConflictError, making it easier to pinpoint the problem.
+ self.storage.set_debug_conflicts(1)
+ conn1 = self.db.open()
+ try:
+ ob1 = self._write_basic_object(conn1)
+ ob1.strdata = 'def'
+ run_in_thread(self._change_test_root)
+ # Don't let the Connection generate the conflict. This is
+ # a test of the storage.
+ conn1._invalidated.clear()
+ self.assertRaises(RuntimeError, get_transaction().commit)
finally:
conn1.close()
More information about the Zope-CVS
mailing list