[Python-checkins] r62892 - python/trunk/Lib/test/test_support.py

brett.cannon python-checkins at python.org
Thu May 8 22:20:24 CEST 2008


Author: brett.cannon
Date: Thu May  8 22:20:24 2008
New Revision: 62892

Log:
Fix a bug introduced by the addition of the 'record' argument to
test.test_support.catch_warning() where showwarning() was not being set
properly.


Modified:
   python/trunk/Lib/test/test_support.py

Modified: python/trunk/Lib/test/test_support.py
==============================================================================
--- python/trunk/Lib/test/test_support.py	(original)
+++ python/trunk/Lib/test/test_support.py	Thu May  8 22:20:24 2008
@@ -406,11 +406,11 @@
             warnings.warn("foo")
             assert str(w.message) == "foo"
     """
+    original_filters = module.filters[:]
+    original_showwarning = module.showwarning
     if record:
         warning_obj = WarningMessage()
         module.showwarning = warning_obj._showwarning
-    original_filters = module.filters[:]
-    original_showwarning = module.showwarning
     try:
         yield warning_obj if record else None
     finally:


More information about the Python-checkins mailing list