[Checkins] SVN: mongopersist/trunk/src/mongopersist/testing.py Provide a proper cleanup hook and use it.

Stephen Richter cvs-admin at zope.org
Tue Apr 3 18:09:54 UTC 2012


Log message for revision 124920:
  Provide a proper cleanup hook and use it.
  

Changed:
  U   mongopersist/trunk/src/mongopersist/testing.py

-=-
Modified: mongopersist/trunk/src/mongopersist/testing.py
===================================================================
--- mongopersist/trunk/src/mongopersist/testing.py	2012-04-03 16:11:35 UTC (rev 124919)
+++ mongopersist/trunk/src/mongopersist/testing.py	2012-04-03 18:09:50 UTC (rev 124920)
@@ -17,7 +17,7 @@
 import pymongo
 import re
 import transaction
-from zope.testing import module, renormalizing
+from zope.testing import cleanup, module, renormalizing
 
 from mongopersist import datamanager, serialize
 
@@ -54,8 +54,13 @@
     transaction.abort()
     test.globs['conn'].drop_database(test.globs['DBNAME'])
     test.globs['conn'].disconnect()
+    resetCaches()
+
+def resetCaches():
     serialize.SERIALIZERS.__init__()
     serialize.OID_CLASS_LRU.__init__(20000)
     serialize.COLLECTIONS_WITH_TYPE.__init__()
     serialize.AVAILABLE_NAME_MAPPINGS.__init__()
     serialize.PATH_RESOLVE_CACHE = {}
+
+cleanup.addCleanUp(resetCaches)



More information about the checkins mailing list