3
3
import sys
4
4
import types
5
5
from errno import ECONNREFUSED
6
- from unittest .mock import patch
6
+ from unittest .mock import patch , AsyncMock
7
7
8
8
import pytest
9
9
import redis
@@ -317,7 +317,6 @@ async def get_redis_connection():
317
317
318
318
319
319
@pytest .mark .onlynoncluster
320
- @pytest .mark .skipif (sys .version_info < (3 , 9 ), reason = "requires python > 3.8" )
321
320
async def test_client_do_not_retry_write_on_read_failure (mock_connection , mock_pool ):
322
321
mock_connection .send_command .return_value = True
323
322
mock_connection .read_response .side_effect = [
@@ -327,7 +326,7 @@ async def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_p
327
326
]
328
327
mock_connection .retry = Retry (ExponentialBackoff (), 3 )
329
328
mock_connection .retry_on_error = (ConnectionError ,)
330
- mock_pool .get_connection . return_value = mock_connection
329
+ mock_pool .get_connection = AsyncMock ( return_value = mock_connection )
331
330
mock_pool .connection_kwargs = {}
332
331
333
332
r = Redis (
@@ -343,7 +342,6 @@ async def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_p
343
342
344
343
345
344
@pytest .mark .onlynoncluster
346
- @pytest .mark .skipif (sys .version_info < (3 , 9 ), reason = "requires python > 3.8" )
347
345
async def test_pipeline_immediate_do_not_retry_write_on_read_failure (
348
346
mock_connection , mock_pool
349
347
):
@@ -355,7 +353,7 @@ async def test_pipeline_immediate_do_not_retry_write_on_read_failure(
355
353
]
356
354
mock_connection .retry = Retry (ExponentialBackoff (), 3 )
357
355
mock_connection .retry_on_error = (ConnectionError ,)
358
- mock_pool .get_connection . return_value = mock_connection
356
+ mock_pool .get_connection = AsyncMock ( return_value = mock_connection )
359
357
mock_pool .connection_kwargs = {}
360
358
361
359
r = Redis (
0 commit comments