Skip to content

Commit a4601a7

Browse files
committed
skip test sentinel managed connection if hirediswq
1 parent bb69c85 commit a4601a7

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

redis/asyncio/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,9 @@ def __init__(
11291129
self.connection_kwargs = connection_kwargs
11301130
self.max_connections = max_connections
11311131

1132-
self._available_connections: ConnectionsIndexer = ConnectionsIndexer()
1132+
self._available_connections: ConnectionsIndexer = (
1133+
ConnectionsIndexer() if index_available_connections else []
1134+
)
11331135
self._in_use_connections: Set[AbstractConnection] = set()
11341136
self._index_available_connections = index_available_connections
11351137
self.encoder_class = self.connection_kwargs.get("encoder_class", Encoder)

tests/test_asyncio/test_sentinel_managed_connection.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def same_address(
111111
)
112112

113113

114+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
114115
async def test_connects_to_same_address_if_same_id_replica(
115116
connection_pool_replica_mock: SentinelConnectionPool,
116117
) -> None:
@@ -128,6 +129,7 @@ async def test_connects_to_same_address_if_same_id_replica(
128129
)
129130

130131

132+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
131133
async def test_connects_to_same_conn_object_if_same_id_and_conn_released_replica(
132134
connection_pool_replica_mock: SentinelConnectionPool,
133135
) -> None:
@@ -148,6 +150,7 @@ async def test_connects_to_same_conn_object_if_same_id_and_conn_released_replica
148150
)
149151

150152

153+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
151154
async def test_connects_to_diff_address_if_no_iter_req_id_replica(
152155
connection_pool_replica_mock: SentinelConnectionPool,
153156
) -> None:
@@ -173,6 +176,7 @@ async def test_connects_to_diff_address_if_no_iter_req_id_replica(
173176
)
174177

175178

179+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
176180
async def test_connects_to_same_address_if_same_iter_req_id_master(
177181
connection_pool_master_mock: SentinelConnectionPool,
178182
) -> None:
@@ -190,6 +194,7 @@ async def test_connects_to_same_address_if_same_iter_req_id_master(
190194
)
191195

192196

197+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
193198
async def test_connects_to_same_conn_object_if_same_iter_req_id_and_released_master(
194199
connection_pool_master_mock: SentinelConnectionPool,
195200
) -> None:
@@ -209,6 +214,7 @@ async def test_connects_to_same_conn_object_if_same_iter_req_id_and_released_mas
209214
)
210215

211216

217+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
212218
async def test_connects_to_same_address_if_no_iter_req_id_master(
213219
connection_pool_master_mock: SentinelConnectionPool,
214220
) -> None:
@@ -234,6 +240,7 @@ async def test_connects_to_same_address_if_no_iter_req_id_master(
234240
)
235241

236242

243+
@pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
237244
async def test_scan_iter_family_cleans_up(
238245
connection_pool_replica_mock: SentinelConnectionPool,
239246
):

tests/test_sentinel_managed_connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from redis import Redis
66
from redis.sentinel import Sentinel, SentinelConnectionPool, SentinelManagedConnection
77

8+
pytestmark = pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
9+
810

911
class SentinelManagedConnectionMock(SentinelManagedConnection):
1012
def _connect_to_sentinel(self) -> None:

0 commit comments

Comments
 (0)