From 6ab541ea4ea2e870dd3fb5de0d0bdce113ed8831 Mon Sep 17 00:00:00 2001 From: Andrey Maltsev Date: Tue, 4 Apr 2023 09:02:17 +0000 Subject: [PATCH] Update test_global.py from Cpython v3.11.2 --- Lib/test/test_global.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py index d0bde3fd04..f5b38c25ea 100644 --- a/Lib/test/test_global.py +++ b/Lib/test/test_global.py @@ -9,14 +9,9 @@ class GlobalTests(unittest.TestCase): def setUp(self): - self._warnings_manager = check_warnings() - self._warnings_manager.__enter__() + self.enterContext(check_warnings()) warnings.filterwarnings("error", module="") - def tearDown(self): - self._warnings_manager.__exit__(None, None, None) - - def test1(self): prog_text_1 = """\ def wrong1(): @@ -54,9 +49,7 @@ def test4(self): def setUpModule(): - cm = warnings.catch_warnings() - cm.__enter__() - unittest.addModuleCleanup(cm.__exit__, None, None, None) + unittest.enterModuleContext(warnings.catch_warnings()) warnings.filterwarnings("error", module="")