[Zodb-checkins] CVS: ZODB3/ZODB/tests - testZODB.py:1.5.2.2

Shane Hathaway shane@zope.com
Tue, 14 Jan 2003 11:16:22 -0500


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv28477/tests

Modified Files:
      Tag: ZODB3-3_1-branch
	testZODB.py 
Log Message:
Merge from HEAD: fixed a minor memory leak in _resetCache().


=== ZODB3/ZODB/tests/testZODB.py 1.5.2.1 => 1.5.2.2 ===
--- ZODB3/ZODB/tests/testZODB.py:1.5.2.1	Tue Nov 12 15:18:08 2002
+++ ZODB3/ZODB/tests/testZODB.py	Tue Jan 14 11:16:18 2003
@@ -104,6 +104,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')