[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/tests/ Merge rev 29931 from 3.4 branch.

Tim Peters tim.one at comcast.net
Sat Apr 9 21:53:38 EDT 2005


Log message for revision 29932:
  Merge rev 29931 from 3.4 branch.
  
  test_cache():  Muck with Python's warnings module.
  
  The test didn't work if run more than once (e.g., via Zope3's
  test.py's "-N <n>" argument, or via ZODB's test.py's "-L"
  argument), because the warnings module suppresses warnings
  after the first from a single line.  Made the warnings module
  report repeats of DeprecationWarnings for the duration of
  the test.
  

Changed:
  U   ZODB/trunk/src/ZODB/tests/testConnection.py
  U   ZODB/trunk/src/ZODB/tests/warnhook.py

-=-
Modified: ZODB/trunk/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testConnection.py	2005-04-10 01:52:14 UTC (rev 29931)
+++ ZODB/trunk/src/ZODB/tests/testConnection.py	2005-04-10 01:53:37 UTC (rev 29932)
@@ -407,6 +407,13 @@
         >>> hook = WarningsHook()
         >>> hook.install()
 
+        More problems in case this test is run more than once:  fool the
+        warnings module into delivering the warnings despite that they've
+        been seen before.
+
+        >>> import warnings
+        >>> warnings.filterwarnings("always", category=DeprecationWarning)
+
         >>> r._p_activate()
         >>> cn.cacheMinimize(12)
         >>> r._p_state
@@ -450,6 +457,10 @@
 
         >>> hook.uninstall()
 
+        Obscure:  There is no API call for removing the filter we added, but
+        filters appears to be a public variable.
+
+        >>> del warnings.filters[0]
         """
 
 class InvalidationTests(unittest.TestCase):

Modified: ZODB/trunk/src/ZODB/tests/warnhook.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/warnhook.py	2005-04-10 01:52:14 UTC (rev 29931)
+++ ZODB/trunk/src/ZODB/tests/warnhook.py	2005-04-10 01:53:37 UTC (rev 29932)
@@ -20,7 +20,7 @@
     application code, allowing the application to customize the way it
     handles warnings.
 
-    This hook captures the unformatted warning information and stored
+    This hook captures the unformatted warning information and stores
     it in a list.  A test can inspect this list after the test is over.
 
     Issues:



More information about the Zodb-checkins mailing list