Commit 19196d43 authored by Brett Cannon's avatar Brett Cannon

Clean up the manipulation of the warnings filter in test_builtin.

parent 3eb42ad9
...@@ -2,15 +2,11 @@ ...@@ -2,15 +2,11 @@
import platform import platform
import unittest 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 from operator import neg
import sys, warnings, random, collections, io 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 import builtins
class Squares: class Squares:
...@@ -427,9 +423,10 @@ class BuiltinTest(unittest.TestCase): ...@@ -427,9 +423,10 @@ class BuiltinTest(unittest.TestCase):
g = {} g = {}
l = {} l = {}
import warnings with check_warnings():
warnings.filterwarnings("ignore", "global statement", module="<string>") warnings.filterwarnings("ignore", "global statement",
exec('global a; a = 1; b = 2', g, l) module="<string>")
exec('global a; a = 1; b = 2', g, l)
if '__builtins__' in g: if '__builtins__' in g:
del g['__builtins__'] del g['__builtins__']
if '__builtins__' in l: if '__builtins__' in l:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment