Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes CAE-333 #3290

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,9 +909,10 @@ 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
14 changes: 14 additions & 0 deletions tests/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ 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():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two blank-lines required between function definition and doc-blocks, as well as after the test

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
Loading