Skip to content

Commit 9eb5994

Browse files
authored
Merge pull request #4832 from Masorubka1/test_global
Update test_global.py from Cpython v3.11.2
2 parents a623616 + 6ab541e commit 9eb5994

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Lib/test/test_global.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@
99
class GlobalTests(unittest.TestCase):
1010

1111
def setUp(self):
12-
self._warnings_manager = check_warnings()
13-
self._warnings_manager.__enter__()
12+
self.enterContext(check_warnings())
1413
warnings.filterwarnings("error", module="<test string>")
1514

16-
def tearDown(self):
17-
self._warnings_manager.__exit__(None, None, None)
18-
19-
2015
def test1(self):
2116
prog_text_1 = """\
2217
def wrong1():
@@ -54,9 +49,7 @@ def test4(self):
5449

5550

5651
def setUpModule():
57-
cm = warnings.catch_warnings()
58-
cm.__enter__()
59-
unittest.addModuleCleanup(cm.__exit__, None, None, None)
52+
unittest.enterModuleContext(warnings.catch_warnings())
6053
warnings.filterwarnings("error", module="<test string>")
6154

6255

0 commit comments

Comments
 (0)