Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tests/unit/skills/test_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Loading