mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
Clean up warnings filter use in test_global by no longer having it be a
module-level manipulation of the filter.
This commit is contained in:
parent
41a08bcb83
commit
2298d538b3
1 changed files with 11 additions and 2 deletions
|
|
@ -1,13 +1,22 @@
|
||||||
"""Verify that warnings are issued for global statements following use."""
|
"""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 unittest
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
warnings.filterwarnings("error", module="<test string>")
|
|
||||||
|
|
||||||
class GlobalTests(unittest.TestCase):
|
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):
|
def test1(self):
|
||||||
prog_text_1 = """\
|
prog_text_1 = """\
|
||||||
def wrong1():
|
def wrong1():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue