Skip to content

Commit a18c648

Browse files
committed
mock asyncio sleep
1 parent 71cbf0d commit a18c648

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/strands/agent/hooks/test_agent_events.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ async def streaming_tool():
3131

3232

3333
@pytest.fixture
34-
def mock_asyncio():
34+
def mock_sleep():
3535
with unittest.mock.patch.object(
36-
strands.event_loop.event_loop, "asyncio", new_callable=unittest.mock.AsyncMock
36+
strands.event_loop.event_loop.asyncio, "sleep", new_callable=unittest.mock.AsyncMock
3737
) as mock:
3838
yield mock
3939

@@ -324,7 +324,7 @@ async def test_stream_e2e_success(alist):
324324

325325

326326
@pytest.mark.asyncio
327-
async def test_stream_e2e_throttle_and_redact(alist, mock_asyncio):
327+
async def test_stream_e2e_throttle_and_redact(alist, mock_sleep):
328328
model = MagicMock()
329329
model.stream.side_effect = [
330330
ModelThrottledException("ThrottlingException | ConverseStream"),
@@ -391,7 +391,7 @@ async def test_stream_e2e_throttle_and_redact(alist, mock_asyncio):
391391
async def test_event_loop_cycle_text_response_throttling_early_end(
392392
agenerator,
393393
alist,
394-
mock_asyncio,
394+
mock_sleep,
395395
):
396396
model = MagicMock()
397397
model.stream.side_effect = [

0 commit comments

Comments
 (0)