diff options
author | Chayim I. Kirshen <c@kirshen.com> | 2021-12-02 19:22:03 +0200 |
---|---|---|
committer | Chayim I. Kirshen <c@kirshen.com> | 2021-12-02 19:22:03 +0200 |
commit | d1ae2eb7f183103a8eff781beb52eec7446ad2a3 (patch) | |
tree | 66ae3706f2226eb04b8a65dd228b208b24298deb | |
parent | f5d5610f0b77468bc84c3c9764a5d86ee7883410 (diff) | |
download | redis-py-ROLE.tar.gz |
master merge, fixing tests with now clusterROLE
-rw-r--r-- | redis/commands/core.py | 10 | ||||
-rw-r--r-- | tests/test_commands.py | 6 | ||||
-rw-r--r-- | tests/test_connection_pool.py | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py index 48e5324..fec3095 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -338,10 +338,10 @@ class ManagementCommands: Provide information on the role of a Redis instance in the context of replication, by returning if the instance is currently a master, slave, or sentinel. - + For more information check https://redis.io/commands/role """ - return self.execute_command('ROLE') + return self.execute_command("ROLE") def client_kill(self, address, **kwargs): """Disconnects the client at ``address`` (ip:port) @@ -874,11 +874,15 @@ class ManagementCommands: For more information check https://redis.io/commands/slowlog-get """ + from redis.client import NEVER_DECODE + args = ["SLOWLOG GET"] if num is not None: args.append(num) decode_responses = self.get_connection_kwargs().get("decode_responses", False) - return self.execute_command(*args, decode_responses=decode_responses, **kwargs) + if decode_responses is True: + kwargs[NEVER_DECODE] = [] + return self.execute_command(*args, **kwargs) def slowlog_len(self, **kwargs): """ diff --git a/tests/test_commands.py b/tests/test_commands.py index af52fbd..556df84 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -653,12 +653,14 @@ class TestRedisCommands: def test_quit(self, r): assert r.quit() - @skip_if_server_version_lt('2.8.12') + @skip_if_server_version_lt("2.8.12") + @pytest.mark.onlynoncluster def test_role(self, r): - assert r.role()[0] == b'master' + assert r.role()[0] == b"master" assert isinstance(r.role()[1], int) assert isinstance(r.role()[2], list) + @pytest.mark.onlynoncluster def test_slowlog_get(self, r, slowlog): assert r.slowlog_reset() unicode_string = chr(3456) + "abcd" + chr(3421) diff --git a/tests/test_connection_pool.py b/tests/test_connection_pool.py index 276e77c..138fcad 100644 --- a/tests/test_connection_pool.py +++ b/tests/test_connection_pool.py @@ -450,7 +450,7 @@ class TestConnectionPoolUnixSocketURLParsing: pass pool = redis.ConnectionPool.from_url( - 'unix:///socket', connection_class=MyConnection + "unix:///socket", connection_class=MyConnection ) assert pool.connection_class == MyConnection @@ -469,7 +469,7 @@ class TestSSLConnectionURLParsing: pass pool = redis.ConnectionPool.from_url( - 'rediss://my.host', connection_class=MyConnection + "rediss://my.host", connection_class=MyConnection ) assert pool.connection_class == MyConnection |