Fix unawaited coroutine warning in test_default_timeout_is_600

The AsyncMock for wait_for discarded the coroutine from
proc.communicate() without consuming it. Replace with a side_effect
that closes the coroutine before returning the mock result.
This commit is contained in:
Kevin Turcios 2026-04-23 04:46:32 -05:00
parent 76a07c7f66
commit 57446aad31

View file

@ -736,17 +736,20 @@ class TestAsyncExecuteTestSubprocess:
mock_proc.returncode = 0
mock_create.return_value = mock_proc
async def _consume_coro(coro, *, timeout):
coro.close()
return (b"out", b"err")
with patch(
"codeflash_python.testing._test_runner.asyncio.wait_for",
new_callable=AsyncMock,
side_effect=_consume_coro,
) as mock_wait:
mock_wait.return_value = (b"out", b"err")
await async_execute_test_subprocess(
["pytest"],
cwd=Path("/project"),
env=None,
)
assert 600 == mock_wait.call_args[1]["timeout"]
assert 600 == mock_wait.call_args.kwargs["timeout"]
@pytest.mark.asyncio
async def test_empty_stdout_returns_empty_string(self) -> None: