[Zodb-checkins] SVN: ZODB/branches/3.4/src/ZODB/tests/ test_cache(): Muck with Python's warnings module.

Tim Peters tim.one at comcast.net
Sat Apr 9 21:52:14 EDT 2005


Log message for revision 29931:
  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 a single line.  Made the warnings module
  report repeats of DeprecationWarnings for the duration of
  the test.
  

Changed:
  U   ZODB/branches/3.4/src/ZODB/tests/testConnection.py
  U   ZODB/branches/3.4/src/ZODB/tests/warnhook.py

-=-
Modified: ZODB/branches/3.4/src/ZODB/tests/testConnection.py
===================================================================
--- ZODB/branches/3.4/src/ZODB/tests/testConnection.py	2005-04-09 17:40:14 UTC (rev 29930)
+++ ZODB/branches/3.4/src/ZODB/tests/testConnection.py	2005-04-10 01:52:14 UTC (rev 29931)
@@ -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/branches/3.4/src/ZODB/tests/warnhook.py
===================================================================
--- ZODB/branches/3.4/src/ZODB/tests/warnhook.py	2005-04-09 17:40:14 UTC (rev 29930)
+++ ZODB/branches/3.4/src/ZODB/tests/warnhook.py	2005-04-10 01:52:14 UTC (rev 29931)
@@ -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