From c687f895ae89bc23daefc011cf8d2e4494ee1fe3 Mon Sep 17 00:00:00 2001 From: Josh Salomon Date: Tue, 15 Sep 2026 15:30:47 +0300 Subject: [PATCH] test: avoid leaking coroutine in timeout test --- tests/unit/skills/test_fetcher.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/unit/skills/test_fetcher.py b/tests/unit/skills/test_fetcher.py index 797687ad3..e1a73f9c6 100644 --- a/tests/unit/skills/test_fetcher.py +++ b/tests/unit/skills/test_fetcher.py @@ -161,15 +161,17 @@ async def test_timeout_raises_and_kills_process(self): """asyncio.TimeoutError is converted to RefResolutionError; process is killed.""" process = MagicMock() process.kill = MagicMock() - # communicate() hangs forever - process.communicate = AsyncMock(side_effect=asyncio.TimeoutError) + + async def communicate_forever(): + await asyncio.Event().wait() + + process.communicate = MagicMock(side_effect=communicate_forever) with ( patch("asyncio.create_subprocess_exec", return_value=process), - patch("asyncio.wait_for", side_effect=asyncio.TimeoutError), pytest.raises(RefResolutionError, match="timed out"), ): - await resolve_ref_sha(REPO_URL, "main", timeout=1) + await resolve_ref_sha(REPO_URL, "main", timeout=0.01) process.kill.assert_called_once()