Skip to content

Commit 709f6ad

Browse files
bpo-32733: Make test_coroutines robust against -Werror (GH-5487) (GH-5490)
(cherry picked from commit 2efb973) Co-authored-by: Nathaniel J. Smith <njs@pobox.com>
1 parent e985afc commit 709f6ad

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Lib/test/test_coroutines.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,15 +2152,10 @@ def a2():
21522152

21532153
def check(depth, msg):
21542154
sys.set_coroutine_origin_tracking_depth(depth)
2155-
with warnings.catch_warnings(record=True) as wlist:
2155+
with self.assertWarns(RuntimeWarning) as cm:
21562156
a2()
21572157
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))
2158+
self.assertEqual(msg, str(cm.warning))
21642159

21652160
orig_depth = sys.get_coroutine_origin_tracking_depth()
21662161
try:

0 commit comments

Comments
 (0)