|
7 | 7 |
|
8 | 8 | import pytest |
9 | 9 | import redis |
10 | | -from redis.connection import to_bool |
11 | | -from redis.utils import SSL_AVAILABLE |
12 | | - |
13 | | -from .conftest import _get_client, skip_if_redis_enterprise, skip_if_server_version_lt |
| 10 | +from redis.cache import CacheConfig |
| 11 | +from redis.connection import CacheProxyConnection, Connection, to_bool |
| 12 | +from redis.utils import HIREDIS_AVAILABLE, SSL_AVAILABLE |
| 13 | + |
| 14 | +from .conftest import ( |
| 15 | + _get_client, |
| 16 | + skip_if_redis_enterprise, |
| 17 | + skip_if_resp_version, |
| 18 | + skip_if_server_version_lt, |
| 19 | +) |
14 | 20 | from .test_pubsub import wait_for_message |
15 | 21 |
|
16 | 22 |
|
@@ -196,6 +202,20 @@ def test_repr_contains_db_info_unix(self): |
196 | 202 | expected = "path=abc,db=0,client_name=test-client" |
197 | 203 | assert expected in repr(pool) |
198 | 204 |
|
| 205 | + @pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only") |
| 206 | + @pytest.mark.onlynoncluster |
| 207 | + @skip_if_resp_version(2) |
| 208 | + @skip_if_server_version_lt("7.4.0") |
| 209 | + def test_initialise_pool_with_cache(self, master_host): |
| 210 | + pool = redis.BlockingConnectionPool( |
| 211 | + connection_class=Connection, |
| 212 | + host=master_host[0], |
| 213 | + port=master_host[1], |
| 214 | + protocol=3, |
| 215 | + cache_config=CacheConfig(), |
| 216 | + ) |
| 217 | + assert isinstance(pool.get_connection("_"), CacheProxyConnection) |
| 218 | + |
199 | 219 |
|
200 | 220 | class TestConnectionPoolURLParsing: |
201 | 221 | def test_hostname(self): |
|
0 commit comments