diff options
author | Brett Cannon <bcannon@gmail.com> | 2010-03-20 20:59:33 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2010-03-20 20:59:33 (GMT) |
commit | 776289934c74d827290fcb0ba11dafb2e434bf4a (patch) | |
tree | 85be0f78ad4c2927413ab0961da093e370cf5e2a /Lib/test/test_builtin.py | |
parent | 97133720fc38f914a3da927c0edbb1dacdd3ed41 (diff) | |
download | cpython-776289934c74d827290fcb0ba11dafb2e434bf4a.zip cpython-776289934c74d827290fcb0ba11dafb2e434bf4a.tar.gz cpython-776289934c74d827290fcb0ba11dafb2e434bf4a.tar.bz2 |
Clean up the manipulation of the warnings filter in test_builtin.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index c7e03df..5df7efb 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -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 @@ class BuiltinTest(unittest.TestCase): 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: |