SVN: ZODB/trunk/src/persistent/tests/test_PickleCache.py The stdlib doctest.DocTestSuite is broken in such a way that you can't

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <[email protected]>
Log message for revision 116135:
  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/trunk/src/persistent/tests/test_PickleCache.py

-=-
Modified: ZODB/trunk/src/persistent/tests/test_PickleCache.py
===================================================================
--- ZODB/trunk/src/persistent/tests/test_PickleCache.py	2010-09-02 13:55:30 UTC (rev 116134)
+++ ZODB/trunk/src/persistent/tests/test_PickleCache.py	2010-09-02 13:55:32 UTC (rev 116135)
@@ -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():
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.