[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests - testZODB.py:1.4.6.2

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


Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv20715/tests

Modified Files:
      Tag: Zope-2_6-branch
	testZODB.py 
Log Message:
Fixed a refresh bug.  When the ZODB cache was reset, the garbage collection
attributes of Connection weren't getting updated.  Fixed and added a test.  


=== Zope/lib/python/ZODB/tests/testZODB.py 1.4.6.1 => 1.4.6.2 ===
--- Zope/lib/python/ZODB/tests/testZODB.py:1.4.6.1	Tue Nov 12 16:13:58 2002
+++ Zope/lib/python/ZODB/tests/testZODB.py	Tue Jan 14 10:18:19 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')