[Python-checkins] [3.6] bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) (GH-7483)

Victor Stinner webhook-mailer at python.org
Thu Jun 7 11:06:54 EDT 2018


https://github.com/python/cpython/commit/2c8d665ba843fe875a4b8f0ae7c7e9099a06f0dc
commit: 2c8d665ba843fe875a4b8f0ae7c7e9099a06f0dc
branch: 3.6
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-06-07T17:06:50+02:00
summary:

[3.6] bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) (GH-7483)

* bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462)

Fix "<CoroWrapper ...> was never yielded from" warning in
PyTask_PyFuture_Tests.test_error_in_call_soon() of
test_asyncio.test_tasks.

Close manually the coroutine on error.

(cherry picked from commit 9f04f0df6fdb27190690bda949d213893d14e807)

* Hide a warning in test_asyncio test_cancel_handshake()

SslProtoHandshakeTests.test_cancel_handshake() of
test_asyncio.test_sslproto: hide a traceback about SSL handshake
failure.

files:
M Lib/test/test_asyncio/test_sslproto.py
M Lib/test/test_asyncio/test_tasks.py

diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 9b198bfd5307..4ffbc0fbec6b 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -59,9 +59,9 @@ def do_handshake(callback):
             return []
 
         waiter.cancel()
-        self.connection_made(ssl_proto, do_handshake=do_handshake)
 
         with test_utils.disable_logger():
+            self.connection_made(ssl_proto, do_handshake=do_handshake)
             self.loop.run_until_complete(handshake_fut)
 
     def test_eof_received_waiter(self):
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 7c5187348bc4..e8ec09efd4ad 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -2076,7 +2076,11 @@ def coro():
         self.assertFalse(m_log.error.called)
 
         with self.assertRaises(ValueError):
-            self.new_task(self.loop, coro())
+            gen = coro()
+            try:
+                self.new_task(self.loop, gen)
+            finally:
+                gen.close()
 
         self.assertTrue(m_log.error.called)
         message = m_log.error.call_args[0][0]



More information about the Python-checkins mailing list