Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Provide a proper cleanup hook and use it.
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Apr 3, 2012
1 parent 48fa9e0 commit 9684e5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mongopersist/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -54,8 +54,13 @@ def tearDown(test):
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)

0 comments on commit 9684e5f

Please sign in to comment.