Skip to content

Commit 33f14f0

Browse files
Fix pyright type errors for asynccontextmanager decorators
Add AsyncIterator import and use proper return type annotation for mock_connect functions: AsyncIterator[tuple[AsyncMock, AsyncMock]] instead of Any.
1 parent ea7813f commit 33f14f0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/server/test_session_roaming.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
import contextlib
8+
from collections.abc import AsyncIterator
89
from typing import Any
910
from unittest.mock import AsyncMock
1011

@@ -291,7 +292,7 @@ async def test_transport_server_task_cleanup_on_exception():
291292
mock_write_stream = AsyncMock()
292293

293294
@contextlib.asynccontextmanager
294-
async def mock_connect() -> Any:
295+
async def mock_connect() -> AsyncIterator[tuple[AsyncMock, AsyncMock]]:
295296
yield (mock_read_stream, mock_write_stream)
296297

297298
async with manager.run():
@@ -334,7 +335,7 @@ async def test_transport_server_task_no_cleanup_on_terminated():
334335
mock_write_stream = AsyncMock()
335336

336337
@contextlib.asynccontextmanager
337-
async def mock_connect() -> Any:
338+
async def mock_connect() -> AsyncIterator[tuple[AsyncMock, AsyncMock]]:
338339
yield (mock_read_stream, mock_write_stream)
339340

340341
async with manager.run():

0 commit comments

Comments
 (0)