33import sys
44import types
55from errno import ECONNREFUSED
6- from unittest .mock import patch
6+ from unittest .mock import patch , AsyncMock
77
88import pytest
99import redis
@@ -317,7 +317,6 @@ async def get_redis_connection():
317317
318318
319319@pytest .mark .onlynoncluster
320- @pytest .mark .skipif (sys .version_info < (3 , 9 ), reason = "requires python > 3.8" )
321320async def test_client_do_not_retry_write_on_read_failure (mock_connection , mock_pool ):
322321 mock_connection .send_command .return_value = True
323322 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
327326 ]
328327 mock_connection .retry = Retry (ExponentialBackoff (), 3 )
329328 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 )
331330 mock_pool .connection_kwargs = {}
332331
333332 r = Redis (
@@ -343,7 +342,6 @@ async def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_p
343342
344343
345344@pytest .mark .onlynoncluster
346- @pytest .mark .skipif (sys .version_info < (3 , 9 ), reason = "requires python > 3.8" )
347345async def test_pipeline_immediate_do_not_retry_write_on_read_failure (
348346 mock_connection , mock_pool
349347):
@@ -355,7 +353,7 @@ async def test_pipeline_immediate_do_not_retry_write_on_read_failure(
355353 ]
356354 mock_connection .retry = Retry (ExponentialBackoff (), 3 )
357355 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 )
359357 mock_pool .connection_kwargs = {}
360358
361359 r = Redis (
0 commit comments