From a65ad3c7b188a59ec79d50ddbc169dcad1cf6643 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Tue, 13 Feb 2024 11:59:13 -0800 Subject: [PATCH] Fix `test_signalctl_wait_for_09` (#6835) Under Python 3.12+ `stdin.readline()` is returning `EOF` after the process is terminated; let's replace it with a infinite future. Co-authored-by: Fantix King --- tests/common/test_signalctl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/common/test_signalctl.py b/tests/common/test_signalctl.py index b88a84ec4ee..99e749921f5 100644 --- a/tests/common/test_signalctl.py +++ b/tests/common/test_signalctl.py @@ -311,9 +311,10 @@ async def _task(): try: await self.wait_for_parent(2) # cancelled by signal except asyncio.CancelledError: - # In case the task cancellation is hanging, .. + # In case the task cancellation is hanging, we should still + # be able to reliably cancel the task, see timeout below fut.set_result(None) - await self.wait_for_parent(2) + await self.loop.create_future() with signalctl.SignalController(signal.SIGTERM) as sc: task = self.loop.create_task( @@ -321,7 +322,6 @@ async def _task(): ) await fut - # .. we should still be able to reliably cancel the task with self.assertRaises(asyncio.TimeoutError): await asyncio.wait_for(task, 0.2) self.assertTrue(task.done())