2
2
import pytest
3
3
4
4
from redis .exceptions import ConnectionError
5
- from redis .connection import Connection
5
+ from redis .connection import Connection , UnixDomainSocketConnection
6
6
from redis .retry import Retry
7
7
8
8
@@ -20,20 +20,22 @@ def compute(self, failures):
20
20
21
21
22
22
class TestConnectionConstructorWithRetry :
23
- "Test that the Connection constructor properly handles Retry objects"
23
+ "Test that the Connection constructors properly handles Retry objects"
24
24
25
25
@pytest .mark .parametrize ("retry_on_timeout" , [False , True ])
26
- def test_retry_on_timeout_boolean (self , retry_on_timeout ):
27
- c = Connection (retry_on_timeout = retry_on_timeout )
26
+ @pytest .mark .parametrize ("Class" , [Connection , UnixDomainSocketConnection ])
27
+ def test_retry_on_timeout_boolean (self , Class , retry_on_timeout ):
28
+ c = Class (retry_on_timeout = retry_on_timeout )
28
29
assert c .retry_on_timeout == retry_on_timeout
29
30
assert isinstance (c .retry , Retry )
30
31
assert c .retry ._retries == (1 if retry_on_timeout else 0 )
31
32
32
33
@pytest .mark .parametrize ("retries" , range (10 ))
33
- def test_retry_on_timeout_retry (self , retries ):
34
+ @pytest .mark .parametrize ("Class" , [Connection , UnixDomainSocketConnection ])
35
+ def test_retry_on_timeout_retry (self , Class , retries ):
34
36
retry_on_timeout = retries > 0
35
- c = Connection (retry_on_timeout = retry_on_timeout ,
36
- retry = Retry (NoBackoff (), retries ))
37
+ c = Class (retry_on_timeout = retry_on_timeout ,
38
+ retry = Retry (NoBackoff (), retries ))
37
39
assert c .retry_on_timeout == retry_on_timeout
38
40
assert isinstance (c .retry , Retry )
39
41
assert c .retry ._retries == retries
0 commit comments