]> granicus.if.org Git - python/commitdiff
capture stderr to silence output during test_coroutines (closes #27968)
authorBenjamin Peterson <benjamin@python.org>
Wed, 7 Sep 2016 16:00:48 +0000 (09:00 -0700)
committerBenjamin Peterson <benjamin@python.org>
Wed, 7 Sep 2016 16:00:48 +0000 (09:00 -0700)
Lib/test/test_coroutines.py

index 79cbec9899b0855ce3eda82f21d4ec14a1eaf479..e52654c14d0183704784f82d6f45bae996ace432 100644 (file)
@@ -1568,10 +1568,11 @@ class CoroutineTest(unittest.TestCase):
     def test_fatal_coro_warning(self):
         # Issue 27811
         async def func(): pass
-        with warnings.catch_warnings():
+        with warnings.catch_warnings(), support.captured_stderr() as stderr:
             warnings.filterwarnings("error")
             func()
             support.gc_collect()
+        self.assertIn("was never awaited", stderr.getvalue())
 
 
 class CoroAsyncIOCompatTest(unittest.TestCase):