@@ -100,6 +100,7 @@ def test_strict_redis_connection_instance_info(args, kwargs, expected):
100
100
if (3 , 5 , 3 ) >= REDIS_PY_VERSION >= (2 , 7 , 5 ):
101
101
_instance_info_from_url_tests .append ((("redis://127.0.0.1" ,), {}, ("127.0.0.1" , "6379" , "0" )))
102
102
103
+
103
104
if REDIS_PY_VERSION >= (2 , 10 ):
104
105
_instance_info_from_url_tests .extend (
105
106
[
@@ -115,6 +116,13 @@ def test_strict_redis_connection_instance_info(args, kwargs, expected):
115
116
]
116
117
)
117
118
119
+ if REDIS_PY_VERSION >= (4 , 5 , 2 ):
120
+ _instance_info_from_url_tests_4_5_2 = _instance_info_from_url_tests [:- 3 ] + [
121
+ (("unix:///path/to/socket.sock" ,), {}, ("localhost" , "6379" , "0" )),
122
+ (("unix:///path/to/socket.sock?db=2" ,), {}, ("localhost" , "6379" , "2" )),
123
+ (("unix:///path/to/socket.sock" ,), {"db" : 2 }, ("localhost" , "6379" , "2" )),
124
+ ]
125
+
118
126
119
127
@pytest .mark .skipif (REDIS_PY_VERSION < (2 , 6 ), reason = "from_url not yet implemented in this redis-py version" )
120
128
@pytest .mark .parametrize ("args,kwargs,expected" , _instance_info_from_url_tests )
@@ -133,7 +141,10 @@ def test_strict_redis_client_from_url(args, kwargs, expected):
133
141
134
142
135
143
@pytest .mark .skipif (REDIS_PY_VERSION < (2 , 6 ), reason = "from_url not yet implemented in this redis-py version" )
136
- @pytest .mark .parametrize ("args,kwargs,expected" , _instance_info_from_url_tests )
144
+ @pytest .mark .parametrize (
145
+ "args,kwargs,expected" ,
146
+ _instance_info_from_url_tests if REDIS_PY_VERSION < (4 , 5 , 2 ) else _instance_info_from_url_tests_4_5_2 ,
147
+ )
137
148
def test_redis_connection_from_url (args , kwargs , expected ):
138
149
r = redis .Redis .from_url (* args , ** kwargs )
139
150
if r .connection_pool .connection_class is redis .Connection :
@@ -153,7 +164,10 @@ def test_redis_connection_from_url(args, kwargs, expected):
153
164
154
165
155
166
@pytest .mark .skipif (REDIS_PY_VERSION < (2 , 6 ), reason = "from_url not yet implemented in this redis-py version" )
156
- @pytest .mark .parametrize ("args,kwargs,expected" , _instance_info_from_url_tests )
167
+ @pytest .mark .parametrize (
168
+ "args,kwargs,expected" ,
169
+ _instance_info_from_url_tests if REDIS_PY_VERSION < (4 , 5 , 2 ) else _instance_info_from_url_tests_4_5_2 ,
170
+ )
157
171
def test_strict_redis_connection_from_url (args , kwargs , expected ):
158
172
r = redis .StrictRedis .from_url (* args , ** kwargs )
159
173
if r .connection_pool .connection_class is redis .Connection :
0 commit comments