[Zodb-checkins] SVN: ZODB/branches/jim-readCurrent/src/persistent/tests/test_PickleCache.py Fixed a reference leak.
Jim Fulton
jim at zope.com
Wed Sep 1 18:03:44 EDT 2010
Log message for revision 116111:
Fixed a reference leak.
The stdlib doctest.DocTestSuite is broken in such a way that you can't
repeat tests. Provide an environment variable to use the doctest from
zope.testing.
Changed:
U ZODB/branches/jim-readCurrent/src/persistent/tests/test_PickleCache.py
-=-
Modified: ZODB/branches/jim-readCurrent/src/persistent/tests/test_PickleCache.py
===================================================================
--- ZODB/branches/jim-readCurrent/src/persistent/tests/test_PickleCache.py 2010-09-01 22:03:42 UTC (rev 116110)
+++ ZODB/branches/jim-readCurrent/src/persistent/tests/test_PickleCache.py 2010-09-01 22:03:44 UTC (rev 116111)
@@ -109,8 +109,35 @@
"""
+def cache_invalidate_used_to_leak_None_ref():
+ """Persistent weak references
-from doctest import DocTestSuite
+ >>> import transaction
+ >>> import ZODB.tests.util
+
+ >>> db = ZODB.tests.util.DB()
+
+ >>> conn = db.open()
+ >>> conn.root.p = p = conn.root().__class__()
+ >>> transaction.commit()
+
+ >>> import sys
+ >>> old = sys.getrefcount(None)
+ >>> conn._cache.invalidate(p._p_oid)
+ >>> sys.getrefcount(None) - old
+ 0
+
+ >>> db.close()
+
+ """
+
+
+import os
+if os.environ.get('USE_ZOPE_TESTING_DOCTEST'):
+ from zope.testing.doctest import DocTestSuite
+else:
+ from doctest import DocTestSuite
+
import unittest
def test_suite():
More information about the Zodb-checkins
mailing list