We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 143036a commit 6ab541eCopy full SHA for 6ab541e
Lib/test/test_global.py
@@ -9,14 +9,9 @@
9
class GlobalTests(unittest.TestCase):
10
11
def setUp(self):
12
- self._warnings_manager = check_warnings()
13
- self._warnings_manager.__enter__()
+ self.enterContext(check_warnings())
14
warnings.filterwarnings("error", module="<test string>")
15
16
- def tearDown(self):
17
- self._warnings_manager.__exit__(None, None, None)
18
-
19
20
def test1(self):
21
prog_text_1 = """\
22
def wrong1():
@@ -54,9 +49,7 @@ def test4(self):
54
49
55
50
56
51
def setUpModule():
57
- cm = warnings.catch_warnings()
58
- cm.__enter__()
59
- unittest.addModuleCleanup(cm.__exit__, None, None, None)
52
+ unittest.enterModuleContext(warnings.catch_warnings())
60
53
61
62
0 commit comments