[Zodb-checkins] CVS: Zope/lib/python/ZODB/tests - testZODB.py:1.19
Shane Hathaway
shane at zope.com
Wed Dec 10 15:02:16 EST 2003
Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv2631/tests
Modified Files:
testZODB.py
Log Message:
Improved documentation of the refresh-related functionality.
- Renamed updateCodeTimestamp() to resetCaches().
- Added a test of resetCaches().
- Removed a spurious comment about chaining connections together.
=== Zope/lib/python/ZODB/tests/testZODB.py 1.18 => 1.19 ===
--- Zope/lib/python/ZODB/tests/testZODB.py:1.18 Fri Nov 28 11:44:54 2003
+++ Zope/lib/python/ZODB/tests/testZODB.py Wed Dec 10 15:02:15 2003
@@ -139,6 +139,9 @@
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.
+ # Note that _resetCache is not a public API, but the
+ # resetCaches() function is, and resetCaches() causes
+ # _resetCache() to be called.
self.populate()
conn = self._db.open()
conn.root()
@@ -148,6 +151,19 @@
self.assert_(conn._incrgc == conn._cache.incrgc)
self.assert_(conn.cacheGC == conn._cache.incrgc)
+ def checkResetCachesAPI(self):
+ # Checks the resetCaches() API.
+ # (resetCaches used to be called updateCodeTimestamp.)
+ self.populate()
+ conn = self._db.open()
+ conn.root()
+ self.assert_(len(conn._cache) > 0) # Precondition
+ ZODB.Connection.resetCaches()
+ conn.close()
+ self.assert_(len(conn._cache) > 0) # Still not flushed
+ conn._setDB(self._db) # simulate the connection being reopened
+ self.assertEqual(len(conn._cache), 0)
+
def checkLocalTransactions(self):
# Test of transactions that apply to only the connection,
# not the thread.
@@ -282,3 +298,7 @@
def test_suite():
return unittest.makeSuite(ZODBTests, 'check')
+
+if __name__ == "__main__":
+ unittest.main(defaultTest="test_suite")
+
More information about the Zodb-checkins
mailing list