Skip to content

Commit 93da5b1

Browse files
committed
Added hack to make mocks awaitable
1 parent f55e0bc commit 93da5b1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_asyncio/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,19 @@ async def mock_cluster_resp_slaves(create_redis, **kwargs):
223223
@pytest_asyncio.fixture()
224224
def mock_connection() -> Connection:
225225
mock_connection = AsyncMock(spec=Connection)
226+
mock_connection.__await__ = dummy_awaitable
226227
return mock_connection
227228

228229

229230
@pytest_asyncio.fixture()
230231
def mock_pool() -> ConnectionPool:
231232
mock_pool = AsyncMock(spec=ConnectionPool)
233+
mock_pool.__await__ = dummy_awaitable
232234
return mock_pool
233235

236+
def dummy_awaitable():
237+
pass
238+
234239

235240
@pytest_asyncio.fixture()
236241
async def credential_provider(request) -> CredentialProvider:

0 commit comments

Comments
 (0)