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 e985afc commit 709f6adCopy full SHA for 709f6ad
Lib/test/test_coroutines.py
@@ -2152,15 +2152,10 @@ def a2():
2152
2153
def check(depth, msg):
2154
sys.set_coroutine_origin_tracking_depth(depth)
2155
- with warnings.catch_warnings(record=True) as wlist:
+ with self.assertWarns(RuntimeWarning) as cm:
2156
a2()
2157
support.gc_collect()
2158
- # This might be fragile if other warnings somehow get triggered
2159
- # inside our 'with' block... let's worry about that if/when it
2160
- # happens.
2161
- self.assertTrue(len(wlist) == 1)
2162
- self.assertIs(wlist[0].category, RuntimeWarning)
2163
- self.assertEqual(msg, str(wlist[0].message))
+ self.assertEqual(msg, str(cm.warning))
2164
2165
orig_depth = sys.get_coroutine_origin_tracking_depth()
2166
try:
0 commit comments