[Python-checkins] r79151 - python/branches/py3k/Lib/test/test_global.py
brett.cannon
python-checkins at python.org
Sat Mar 20 22:48:19 CET 2010
Author: brett.cannon
Date: Sat Mar 20 22:48:19 2010
New Revision: 79151
Log:
Clean up warnings filter use in test_global by no longer having it be a
module-level manipulation of the filter.
Modified:
python/branches/py3k/Lib/test/test_global.py
Modified: python/branches/py3k/Lib/test/test_global.py
==============================================================================
--- python/branches/py3k/Lib/test/test_global.py (original)
+++ python/branches/py3k/Lib/test/test_global.py Sat Mar 20 22:48:19 2010
@@ -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():
More information about the Python-checkins
mailing list