Skip to content

Commit d1ae2eb

Browse files
committed
master merge, fixing tests with now cluster
1 parent f5d5610 commit d1ae2eb

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

redis/commands/core.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ def role(self):
338338
Provide information on the role of a Redis instance in
339339
the context of replication, by returning if the instance
340340
is currently a master, slave, or sentinel.
341-
341+
342342
For more information check https://redis.io/commands/role
343343
"""
344-
return self.execute_command('ROLE')
344+
return self.execute_command("ROLE")
345345

346346
def client_kill(self, address, **kwargs):
347347
"""Disconnects the client at ``address`` (ip:port)
@@ -874,11 +874,15 @@ def slowlog_get(self, num=None, **kwargs):
874874
875875
For more information check https://redis.io/commands/slowlog-get
876876
"""
877+
from redis.client import NEVER_DECODE
878+
877879
args = ["SLOWLOG GET"]
878880
if num is not None:
879881
args.append(num)
880882
decode_responses = self.get_connection_kwargs().get("decode_responses", False)
881-
return self.execute_command(*args, decode_responses=decode_responses, **kwargs)
883+
if decode_responses is True:
884+
kwargs[NEVER_DECODE] = []
885+
return self.execute_command(*args, **kwargs)
882886

883887
def slowlog_len(self, **kwargs):
884888
"""

tests/test_commands.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,14 @@ def test_ping(self, r):
653653
def test_quit(self, r):
654654
assert r.quit()
655655

656-
@skip_if_server_version_lt('2.8.12')
656+
@skip_if_server_version_lt("2.8.12")
657+
@pytest.mark.onlynoncluster
657658
def test_role(self, r):
658-
assert r.role()[0] == b'master'
659+
assert r.role()[0] == b"master"
659660
assert isinstance(r.role()[1], int)
660661
assert isinstance(r.role()[2], list)
661662

663+
@pytest.mark.onlynoncluster
662664
def test_slowlog_get(self, r, slowlog):
663665
assert r.slowlog_reset()
664666
unicode_string = chr(3456) + "abcd" + chr(3421)

tests/test_connection_pool.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ class MyConnection(redis.UnixDomainSocketConnection):
450450
pass
451451

452452
pool = redis.ConnectionPool.from_url(
453-
'unix:///socket', connection_class=MyConnection
453+
"unix:///socket", connection_class=MyConnection
454454
)
455455
assert pool.connection_class == MyConnection
456456

@@ -469,7 +469,7 @@ class MyConnection(redis.SSLConnection):
469469
pass
470470

471471
pool = redis.ConnectionPool.from_url(
472-
'rediss://my.host', connection_class=MyConnection
472+
"rediss://my.host", connection_class=MyConnection
473473
)
474474
assert pool.connection_class == MyConnection
475475

0 commit comments

Comments
 (0)