mirror of
https://github.com/codeflash-ai/codeflash-agent.git
synced 2026-05-04 18:25:19 +00:00
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:
parent
76a07c7f66
commit
57446aad31
1 changed files with 6 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue