diff --git a/tests/test_context.py b/tests/test_context.py index 2b2329f9..1ea360c7 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -474,6 +474,11 @@ def close(): # send data await self.loop.run_in_executor(None, ssl_sock.send, b'hello') + # After gh-105836 run_in_executor may resolve without + # yielding. This is very noticeable when PYTHONASYNCIODEBUG + # is set. Hence, we yield explicitly so that the sent data + # can reach the SSL buffer before close/resume_reading. + await asyncio.sleep(0) # schedule a proactive transport close which will trigger # the flushing process to retrieve the remaining data self.loop.call_soon(close)