[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests - testZODB.py:1.8
Shane Hathaway
shane@zope.com
Tue, 14 Jan 2003 10:20:25 -0500
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv21180/tests
Modified Files:
testZODB.py
Log Message:
Fixed the _resetCache() bug. The garbage collection attributes weren't being
updated, which resulted in one whole cache being kept for no reason.
=== Zope/lib/python/ZODB/tests/testZODB.py 1.7 => 1.8 ===
--- Zope/lib/python/ZODB/tests/testZODB.py:1.7 Thu Dec 5 19:00:52 2002
+++ Zope/lib/python/ZODB/tests/testZODB.py Tue Jan 14 10:20:22 2003
@@ -117,6 +117,21 @@
self._db.abortVersion("version")
get_transaction().commit()
+ def checkResetCache(self):
+ # The cache size after a reset should be 0 and the GC attributes
+ # ought to be linked to it rather than the old cache.
+ conn = self._db.open()
+ try:
+ conn.root()
+ self.assert_(len(conn._cache) > 0) # Precondition
+ conn._resetCache()
+ self.assertEqual(len(conn._cache), 0)
+ self.assert_(conn._incrgc == conn._cache.incrgc)
+ self.assert_(conn.cacheGC == conn._cache.incrgc)
+ finally:
+ conn.close()
+
+
def test_suite():
return unittest.makeSuite(ZODBTests, 'check')