[Python-checkins] bpo-32733: Make test_coroutines robust against -Werror (GH-5487)
Nathaniel J. Smith
webhook-mailer at python.org
Thu Feb 1 23:56:06 EST 2018
https://github.com/python/cpython/commit/2efb9735899c7c642f3e75a121af82b1679577d3
commit: 2efb9735899c7c642f3e75a121af82b1679577d3
branch: master
author: Nathaniel J. Smith <njs at pobox.com>
committer: GitHub <noreply at github.com>
date: 2018-02-01T20:55:55-08:00
summary:
bpo-32733: Make test_coroutines robust against -Werror (GH-5487)
files:
M Lib/test/test_coroutines.py
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index f3d77192ae76..b37b61b71959 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -2152,15 +2152,10 @@ def a2():
def check(depth, msg):
sys.set_coroutine_origin_tracking_depth(depth)
- with warnings.catch_warnings(record=True) as wlist:
+ with self.assertWarns(RuntimeWarning) as cm:
a2()
support.gc_collect()
- # This might be fragile if other warnings somehow get triggered
- # 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))
+ self.assertEqual(msg, str(cm.warning))
orig_depth = sys.get_coroutine_origin_tracking_depth()
try:
More information about the Python-checkins
mailing list