Kaydet (Commit) 709f6ad7 authored tarafından Miss Islington (bot)'s avatar Miss Islington (bot) Kaydeden (comit) Nathaniel J. Smith

bpo-32733: Make test_coroutines robust against -Werror (GH-5487) (GH-5490)

(cherry picked from commit 2efb9735)
Co-authored-by: 's avatarNathaniel J. Smith <njs@pobox.com>
üst e985afc3
...@@ -2152,15 +2152,10 @@ class OriginTrackingTest(unittest.TestCase): ...@@ -2152,15 +2152,10 @@ class OriginTrackingTest(unittest.TestCase):
def check(depth, msg): def check(depth, msg):
sys.set_coroutine_origin_tracking_depth(depth) sys.set_coroutine_origin_tracking_depth(depth)
with warnings.catch_warnings(record=True) as wlist: with self.assertWarns(RuntimeWarning) as cm:
a2() a2()
support.gc_collect() support.gc_collect()
# This might be fragile if other warnings somehow get triggered self.assertEqual(msg, str(cm.warning))
# inside our 'with' block... let's worry about that if/when it
# happens.
self.assertTrue(len(wlist) == 1)
self.assertIs(wlist[0].category, RuntimeWarning)
self.assertEqual(msg, str(wlist[0].message))
orig_depth = sys.get_coroutine_origin_tracking_depth() orig_depth = sys.get_coroutine_origin_tracking_depth()
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment