Skip to content

Commit

Permalink
Raising NotImplementedError for SCRIPT DEBUG and DEBUG SEGFAULT (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
chayim authored Oct 18, 2021
1 parent 7f96435 commit 039488d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ def debug_object(self, key):
"""Returns version specific meta information about a given key"""
return self.execute_command('DEBUG OBJECT', key)

def debug_segfault(self):
raise NotImplementedError(
"DEBUG SEGFAULT is intentionally not implemented in the client."
)

def echo(self, value):
"""Echo the string back from the server"""
return self.execute_command('ECHO', value)
Expand Down Expand Up @@ -2894,6 +2899,11 @@ def script_exists(self, *args):
"""
return self.execute_command('SCRIPT EXISTS', *args)

def script_debug(self, *args):
raise NotImplementedError(
"SCRIPT DEBUG is intentionally not implemented in the client."
)

def script_flush(self, sync_type="SYNC"):
"""Flush all scripts from the script cache.
``sync_type`` is by default SYNC (synchronous) but it can also be
Expand Down
20 changes: 20 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,16 @@ def test_sunionstore(self, r):
assert r.sunionstore('c', 'a', 'b') == 3
assert r.smembers('c') == {b'1', b'2', b'3'}

@skip_if_server_version_lt('1.0.0')
def test_debug_segfault(self, r):
with pytest.raises(NotImplementedError):
r.debug_segfault()

@skip_if_server_version_lt('3.2.0')
def test_script_debug(self, r):
with pytest.raises(NotImplementedError):
r.script_debug()

# SORTED SET COMMANDS
def test_zadd(self, r):
mapping = {'a1': 1.0, 'a2': 2.0, 'a3': 3.0}
Expand Down Expand Up @@ -3535,6 +3545,16 @@ def test_bitfield_operations(self, r):
.execute())
assert resp == [0, None, 255]

@skip_if_server_version_lt('4.0.0')
def test_memory_help(self, r):
with pytest.raises(NotImplementedError):
r.memory_help()

@skip_if_server_version_lt('4.0.0')
def test_memory_doctor(self, r):
with pytest.raises(NotImplementedError):
r.memory_doctor()

@skip_if_server_version_lt('4.0.0')
def test_memory_malloc_stats(self, r):
assert r.memory_malloc_stats()
Expand Down

0 comments on commit 039488d

Please sign in to comment.