Skip to content
Closed
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
11 changes: 9 additions & 2 deletions lib/crewai-tools/tests/tools/wait_tool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ def tool():
return WaitTool()


@pytest.fixture
def anyio_backend():
return "asyncio"


@patch("crewai_tools.tools.wait_tool.wait_tool.time.sleep")
def test_waits_requested_duration(mock_sleep, tool):
result = tool.run(seconds=2)
Expand Down Expand Up @@ -65,7 +70,8 @@ def test_negative_seconds_is_rejected_when_passed_positionally(mock_sleep, tool)
mock_sleep.assert_not_called()


@pytest.mark.asyncio
@pytest.mark.block_network(allowed_hosts=[r"127\.0\.0\.1"])
@pytest.mark.anyio
async def test_async_negative_seconds_is_rejected_when_passed_positionally(tool):
with patch(
"crewai_tools.tools.wait_tool.wait_tool.asyncio.sleep", new_callable=AsyncMock
Expand Down Expand Up @@ -106,7 +112,8 @@ def test_invalid_max_seconds_is_rejected():
WaitTool(max_seconds=0)


@pytest.mark.asyncio
@pytest.mark.block_network(allowed_hosts=[r"127\.0\.0\.1"])
@pytest.mark.anyio
async def test_async_wait_caps_long_waits(tool):
with patch(
"crewai_tools.tools.wait_tool.wait_tool.asyncio.sleep", new_callable=AsyncMock
Expand Down
Loading