Skip to content

Commit 12e6b49

Browse files
committed
Restrict async tests to > 3.8
1 parent 5cf8e14 commit 12e6b49

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

tests/test_asyncio/conftest.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import random
22
from contextlib import asynccontextmanager as _asynccontextmanager
3-
from typing import Union, Iterator, Any
3+
from typing import Union
44
from unittest.mock import AsyncMock
55

66
import pytest
@@ -18,12 +18,6 @@
1818
from .compat import mock
1919

2020

21-
class AwaitableMock(AsyncMock):
22-
def __await__(self) -> Iterator[Any]:
23-
self.await_count += 1
24-
return iter([])
25-
26-
2721
async def _get_info(redis_url):
2822
client = redis.Redis.from_url(redis_url)
2923
info = await client.info()
@@ -228,13 +222,13 @@ async def mock_cluster_resp_slaves(create_redis, **kwargs):
228222

229223
@pytest_asyncio.fixture()
230224
def mock_connection() -> Connection:
231-
mock_connection = AwaitableMock(spec=Connection)
225+
mock_connection = AsyncMock(spec=Connection)
232226
return mock_connection
233227

234228

235229
@pytest_asyncio.fixture()
236230
def mock_pool() -> ConnectionPool:
237-
mock_pool = AwaitableMock(spec=ConnectionPool)
231+
mock_pool = AsyncMock(spec=ConnectionPool)
238232
return mock_pool
239233

240234

tests/test_asyncio/test_connection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import socket
3+
import sys
34
import types
45
from errno import ECONNREFUSED
56
from unittest.mock import patch
@@ -316,6 +317,7 @@ async def get_redis_connection():
316317

317318

318319
@pytest.mark.onlynoncluster
320+
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python > 3.8")
319321
async def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_pool):
320322
mock_connection.send_command.return_value = True
321323
mock_connection.read_response.side_effect = [
@@ -341,6 +343,7 @@ async def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_p
341343

342344

343345
@pytest.mark.onlynoncluster
346+
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python > 3.8")
344347
async def test_pipeline_immediate_do_not_retry_write_on_read_failure(
345348
mock_connection, mock_pool
346349
):

0 commit comments

Comments
 (0)