summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_coroutines.py
diff options
context:
space:
mode:
authorNathaniel J. Smith <njs@pobox.com>2018-02-02 04:55:55 (GMT)
committerGitHub <noreply@github.com>2018-02-02 04:55:55 (GMT)
commit2efb9735899c7c642f3e75a121af82b1679577d3 (patch)
tree231f90f6546720e6c68e83360ffe9d1ee8ae0053 /Lib/test/test_coroutines.py
parent461d225b195eec5269f317323b41115516144c41 (diff)
downloadcpython-2efb9735899c7c642f3e75a121af82b1679577d3.zip
cpython-2efb9735899c7c642f3e75a121af82b1679577d3.tar.gz
cpython-2efb9735899c7c642f3e75a121af82b1679577d3.tar.bz2
bpo-32733: Make test_coroutines robust against -Werror (GH-5487)
Diffstat (limited to 'Lib/test/test_coroutines.py')
-rw-r--r--Lib/test/test_coroutines.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index f3d7719..b37b61b 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -2152,15 +2152,10 @@ class OriginTrackingTest(unittest.TestCase):
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: