[Python-checkins] r79149 - python/branches/py3k/Lib/test/test_builtin.py

brett.cannon python-checkins at python.org
Sat Mar 20 21:59:33 CET 2010


Author: brett.cannon
Date: Sat Mar 20 21:59:33 2010
New Revision: 79149

Log:
Clean up the manipulation of the warnings filter in test_builtin.


Modified:
   python/branches/py3k/Lib/test/test_builtin.py

Modified: python/branches/py3k/Lib/test/test_builtin.py
==============================================================================
--- python/branches/py3k/Lib/test/test_builtin.py	(original)
+++ python/branches/py3k/Lib/test/test_builtin.py	Sat Mar 20 21:59:33 2010
@@ -2,15 +2,11 @@
 
 import platform
 import unittest
-from test.support import fcmp, TESTFN, unlink,  run_unittest
+from test.support import fcmp, TESTFN, unlink,  run_unittest, check_warnings
 from operator import neg
 
 import sys, warnings, random, collections, io
 
-warnings.filterwarnings("ignore", "hex../oct.. of negative int",
-                        FutureWarning, __name__)
-warnings.filterwarnings("ignore", "integer argument expected",
-                        DeprecationWarning, "unittest")
 import builtins
 
 class Squares:
@@ -427,9 +423,10 @@
         g = {}
         l = {}
 
-        import warnings
-        warnings.filterwarnings("ignore", "global statement", module="<string>")
-        exec('global a; a = 1; b = 2', g, l)
+        with check_warnings():
+            warnings.filterwarnings("ignore", "global statement",
+                    module="<string>")
+            exec('global a; a = 1; b = 2', g, l)
         if '__builtins__' in g:
             del g['__builtins__']
         if '__builtins__' in l:


More information about the Python-checkins mailing list