Skip to content

Commit 7b3f0d6

Browse files
[5.0] Fixes CAE-333 (#3293)
* 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> * Updated version in setup.py --------- Co-authored-by: David Maier <60782329+dmaier-redislabs@users.noreply.github.com>
1 parent d2084e3 commit 7b3f0d6

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

redis/connection.py

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

820820
def __init__(self, path="", socket_timeout=None, **kwargs):
821+
super().__init__(**kwargs)
821822
self.path = path
822823
self.socket_timeout = socket_timeout
823-
super().__init__(**kwargs)
824824

825825
def repr_pieces(self):
826826
pieces = [("path", self.path), ("db", self.db)]

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
long_description_content_type="text/markdown",
99
keywords=["Redis", "key-value store", "database"],
1010
license="MIT",
11-
version="5.0.6",
11+
version="5.0.7",
1212
packages=find_packages(
1313
include=[
1414
"redis",

tests/test_connect.py

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

9898

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

0 commit comments

Comments
 (0)