Skip to content

Commit b7f9a4c

Browse files
Fixes CAE-333 (#3290)
* Fixes CAE-333, which uncovered that the init method of the base class did override the initialization of the socket_timeout parameter. * Added missing blank lines * Removed blank line * Changed to quotes --------- Co-authored-by: vladvildanov <divinez122@outlook.com>
1 parent 70b4f48 commit b7f9a4c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

redis/connection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -909,9 +909,9 @@ class UnixDomainSocketConnection(AbstractConnection):
909909
"Manages UDS communication to and from a Redis server"
910910

911911
def __init__(self, path="", socket_timeout=None, **kwargs):
912+
super().__init__(**kwargs)
912913
self.path = path
913914
self.socket_timeout = socket_timeout
914-
super().__init__(**kwargs)
915915

916916
def repr_pieces(self):
917917
pieces = [("path", self.path), ("db", self.db)]

tests/test_connect.py

+17
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ def test_tcp_ssl_tls12_custom_ciphers(tcp_address, ssl_ciphers):
9898
_assert_connect(conn, tcp_address, certfile=certfile, keyfile=keyfile)
9999

100100

101+
"""
102+
Addresses bug CAE-333 which uncovered that the init method of the base
103+
class did override the initialization of the socket_timeout parameter.
104+
"""
105+
106+
107+
def test_unix_socket_with_timeout():
108+
conn = UnixDomainSocketConnection(socket_timeout=1000)
109+
110+
# Check if the base class defaults were taken over.
111+
assert conn.db == 0
112+
113+
# Verify if the timeout and the path is set correctly.
114+
assert conn.socket_timeout == 1000
115+
assert conn.path == ""
116+
117+
101118
@pytest.mark.ssl
102119
@pytest.mark.skipif(not ssl.HAS_TLSv1_3, reason="requires TLSv1.3")
103120
def test_tcp_ssl_version_mismatch(tcp_address):

0 commit comments

Comments
 (0)