[Zope-Checkins] CVS: Packages/ZODB/tests - testCache.py:184.108.40.206
tim.one at comcast.net
Thu Feb 24 14:59:04 EST 2005
Update of /cvs-repository/Packages/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv25842/ZODB/tests
Change the exception raised when an attempt is made to add two objects to
the cache with the same oid. The former messsage didn't make sense.
Add a test to verify that this exception does get raised, and that the
message given is the intended one.
This is the first of a series of checkins, to fix critical bugs where
ZODB can in fact raise this exception in rare, but normal, use cases.
=== Packages/ZODB/tests/testCache.py 220.127.116.11 => 18.104.22.168 ===
--- Packages/ZODB/tests/testCache.py:22.214.171.124 Mon Jun 7 18:46:47 2004
+++ Packages/ZODB/tests/testCache.py Thu Feb 24 14:59:04 2005
@@ -369,6 +369,28 @@
self.fail("expect that you can't delete jar of cached object")
+ def checkTwoObjsSameOid(self):
+ # Try to add two distinct objects with the same oid to the cache.
+ # This has always been an error, but the error message prior to
+ # ZODB 3.2.6 didn't make sense. This test verifies that (a) an
+ # exception is raised; and, (b) the error message is the intended
+ # one.
+ obj1 = StubObject()
+ key = obj1._p_oid = p64(1)
+ obj1._p_jar = self.jar
+ self.cache[key] = obj1
+ obj2 = StubObject()
+ obj2._p_oid = key
+ obj2._p_jar = self.jar
+ self.cache[key] = obj2
+ except ValueError, detail:
+ "A different object already has the same oid")
+ self.fail("two objects with the same oid should have failed")
s = unittest.makeSuite(DBMethods, 'check')
More information about the Zope-Checkins