diff options
author | Brett Cannon <bcannon@gmail.com> | 2010-03-20 21:48:19 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2010-03-20 21:48:19 (GMT) |
commit | 2298d538b3f5db9dcd14a1dd1eb38a1e9eee1a94 (patch) | |
tree | c2829cb12e71057eef562ce303d319b46cbaace7 /Lib/test/test_global.py | |
parent | 41a08bcb83e6161eb6b51009d3fd3ca9fce63dc1 (diff) | |
download | cpython-2298d538b3f5db9dcd14a1dd1eb38a1e9eee1a94.zip cpython-2298d538b3f5db9dcd14a1dd1eb38a1e9eee1a94.tar.gz cpython-2298d538b3f5db9dcd14a1dd1eb38a1e9eee1a94.tar.bz2 |
Clean up warnings filter use in test_global by no longer having it be a
module-level manipulation of the filter.
Diffstat (limited to 'Lib/test/test_global.py')
-rw-r--r-- | Lib/test/test_global.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py index 823f2c5..a98e339 100644 --- a/Lib/test/test_global.py +++ b/Lib/test/test_global.py @@ -1,13 +1,22 @@ """Verify that warnings are issued for global statements following use.""" -from test.support import run_unittest, check_syntax_error +from test.support import run_unittest, check_syntax_error, check_warnings import unittest import warnings -warnings.filterwarnings("error", module="<test string>") + class GlobalTests(unittest.TestCase): + def setUp(self): + self._warnings_manager = check_warnings() + self._warnings_manager.__enter__() + warnings.filterwarnings("error", module="<test string>") + + def tearDown(self): + self._warnings_manager.__exit__(None, None, None) + + def test1(self): prog_text_1 = """\ def wrong1(): |