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

Fix parsing of the is_master attribute in the URL #3367

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions redis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ def to_bool(value):
"health_check_interval": int,
"ssl_check_hostname": to_bool,
"timeout": float,
"is_master": to_bool,
}


Expand Down
5 changes: 5 additions & 0 deletions tests/test_connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ def test_extra_querystring_options(self):
assert pool.connection_class == redis.Connection
assert pool.connection_kwargs == {"host": "localhost", "a": "1", "b": "2"}

def test_ismaster_querystring(self):
pool = redis.ConnectionPool.from_url("redis://localhost?1&ismaster=0")
assert pool.connection_class == redis.Connection
assert pool.connection_kwargs == {"host": "localhost", "db": 1,"ismaster": False}

def test_calling_from_subclass_returns_correct_instance(self):
pool = redis.BlockingConnectionPool.from_url("redis://localhost")
assert isinstance(pool, redis.BlockingConnectionPool)
Expand Down