diff --git a/tests/common/test_signalctl.py b/tests/common/test_signalctl.py index 99e749921f5..b88a84ec4ee 100644 --- a/tests/common/test_signalctl.py +++ b/tests/common/test_signalctl.py @@ -311,10 +311,9 @@ async def _task(): try: await self.wait_for_parent(2) # cancelled by signal except asyncio.CancelledError: - # In case the task cancellation is hanging, we should still - # be able to reliably cancel the task, see timeout below + # In case the task cancellation is hanging, .. fut.set_result(None) - await self.loop.create_future() + await self.wait_for_parent(2) with signalctl.SignalController(signal.SIGTERM) as sc: task = self.loop.create_task( @@ -322,6 +321,7 @@ 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())