[Python-checkins] cpython (3.5): capture stderr to silence output during test_coroutines (closes #27968)

benjamin.peterson python-checkins at python.org
Wed Sep 7 12:01:10 EDT 2016


https://hg.python.org/cpython/rev/096dfac57e44
changeset:   103226:096dfac57e44
branch:      3.5
parent:      103223:234f758449f8
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Sep 07 09:00:48 2016 -0700
summary:
  capture stderr to silence output during test_coroutines (closes #27968)

files:
  Lib/test/test_coroutines.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -1568,10 +1568,11 @@
     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):

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list