Skip to content

Commit 0319726

Browse files
dmaier-redislabsvladvildanov
authored andcommitted
Fixes CAE-333 (redis#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 <[email protected]> Signed-off-by: Salvatore Mesoraca <[email protected]>
1 parent 92e3d34 commit 0319726

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

tests/test_connect.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ def test_tcp_ssl_tls12_custom_ciphers(tcp_address, ssl_ciphers):
104104
)
105105

106106

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

valkey/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,9 +907,9 @@ class UnixDomainSocketConnection(AbstractConnection):
907907
"Manages UDS communication to and from a Valkey server"
908908

909909
def __init__(self, path="", socket_timeout=None, **kwargs):
910+
super().__init__(**kwargs)
910911
self.path = path
911912
self.socket_timeout = socket_timeout
912-
super().__init__(**kwargs)
913913

914914
def repr_pieces(self):
915915
pieces = [("path", self.path), ("db", self.db)]

0 commit comments

Comments
 (0)