[Python-checkins] r70982 - in python/branches/py3k: Lib/test/test_warnings.py

brett.cannon python-checkins at python.org
Wed Apr 1 22:27:30 CEST 2009


Author: brett.cannon
Date: Wed Apr  1 22:27:29 2009
New Revision: 70982

Log:
Merged revisions 70979 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70979 | brett.cannon | 2009-04-01 13:25:48 -0700 (Wed, 01 Apr 2009) | 3 lines
  
  test_warnings ironically had a single test that was not protecting the warnings
  filter and was resetting it.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/test_warnings.py

Modified: python/branches/py3k/Lib/test/test_warnings.py
==============================================================================
--- python/branches/py3k/Lib/test/test_warnings.py	(original)
+++ python/branches/py3k/Lib/test/test_warnings.py	Wed Apr  1 22:27:29 2009
@@ -470,14 +470,14 @@
         self.failUnless(text in result)
 
     def test_showwarning_not_callable(self):
-        self.module.filterwarnings("always", category=UserWarning)
-        old_showwarning = self.module.showwarning
-        self.module.showwarning = 23
-        try:
-            self.assertRaises(TypeError, self.module.warn, "Warning!")
-        finally:
-            self.module.showwarning = old_showwarning
-            self.module.resetwarnings()
+        with original_warnings.catch_warnings(module=self.module):
+            self.module.filterwarnings("always", category=UserWarning)
+            old_showwarning = self.module.showwarning
+            self.module.showwarning = 23
+            try:
+                self.assertRaises(TypeError, self.module.warn, "Warning!")
+            finally:
+                self.module.showwarning = old_showwarning
 
     def test_show_warning_output(self):
         # With showarning() missing, make sure that output is okay.


More information about the Python-checkins mailing list