Skip to content

Commit

Permalink
[5.0] Fixes CAE-333 (#3293)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
vladvildanov and dmaier-redislabs authored Jun 26, 2024
1 parent d2084e3 commit 7b3f0d6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,9 +818,9 @@ class UnixDomainSocketConnection(AbstractConnection):
"Manages UDS communication to and from a Redis server"

def __init__(self, path="", socket_timeout=None, **kwargs):
super().__init__(**kwargs)
self.path = path
self.socket_timeout = socket_timeout
super().__init__(**kwargs)

def repr_pieces(self):
pieces = [("path", self.path), ("db", self.db)]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
long_description_content_type="text/markdown",
keywords=["Redis", "key-value store", "database"],
license="MIT",
version="5.0.6",
version="5.0.7",
packages=find_packages(
include=[
"redis",
Expand Down
17 changes: 17 additions & 0 deletions tests/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ def test_tcp_ssl_tls12_custom_ciphers(tcp_address, ssl_ciphers):
_assert_connect(conn, tcp_address, certfile=certfile, keyfile=keyfile)


"""
Addresses bug CAE-333 which uncovered that the init method of the base
class did override the initialization of the socket_timeout parameter.
"""


def test_unix_socket_with_timeout():
conn = UnixDomainSocketConnection(socket_timeout=1000)

# Check if the base class defaults were taken over.
assert conn.db == 0

# Verify if the timeout and the path is set correctly.
assert conn.socket_timeout == 1000
assert conn.path == ""


@pytest.mark.ssl
@pytest.mark.skipif(not ssl.HAS_TLSv1_3, reason="requires TLSv1.3")
def test_tcp_ssl_version_mismatch(tcp_address):
Expand Down

0 comments on commit 7b3f0d6

Please sign in to comment.