Skip to content

Commit 039488d

Browse files
authored
Raising NotImplementedError for SCRIPT DEBUG and DEBUG SEGFAULT (#1624)
1 parent 7f96435 commit 039488d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

redis/commands.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ def debug_object(self, key):
485485
"""Returns version specific meta information about a given key"""
486486
return self.execute_command('DEBUG OBJECT', key)
487487

488+
def debug_segfault(self):
489+
raise NotImplementedError(
490+
"DEBUG SEGFAULT is intentionally not implemented in the client."
491+
)
492+
488493
def echo(self, value):
489494
"""Echo the string back from the server"""
490495
return self.execute_command('ECHO', value)
@@ -2894,6 +2899,11 @@ def script_exists(self, *args):
28942899
"""
28952900
return self.execute_command('SCRIPT EXISTS', *args)
28962901

2902+
def script_debug(self, *args):
2903+
raise NotImplementedError(
2904+
"SCRIPT DEBUG is intentionally not implemented in the client."
2905+
)
2906+
28972907
def script_flush(self, sync_type="SYNC"):
28982908
"""Flush all scripts from the script cache.
28992909
``sync_type`` is by default SYNC (synchronous) but it can also be

tests/test_commands.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,16 @@ def test_sunionstore(self, r):
16291629
assert r.sunionstore('c', 'a', 'b') == 3
16301630
assert r.smembers('c') == {b'1', b'2', b'3'}
16311631

1632+
@skip_if_server_version_lt('1.0.0')
1633+
def test_debug_segfault(self, r):
1634+
with pytest.raises(NotImplementedError):
1635+
r.debug_segfault()
1636+
1637+
@skip_if_server_version_lt('3.2.0')
1638+
def test_script_debug(self, r):
1639+
with pytest.raises(NotImplementedError):
1640+
r.script_debug()
1641+
16321642
# SORTED SET COMMANDS
16331643
def test_zadd(self, r):
16341644
mapping = {'a1': 1.0, 'a2': 2.0, 'a3': 3.0}
@@ -3535,6 +3545,16 @@ def test_bitfield_operations(self, r):
35353545
.execute())
35363546
assert resp == [0, None, 255]
35373547

3548+
@skip_if_server_version_lt('4.0.0')
3549+
def test_memory_help(self, r):
3550+
with pytest.raises(NotImplementedError):
3551+
r.memory_help()
3552+
3553+
@skip_if_server_version_lt('4.0.0')
3554+
def test_memory_doctor(self, r):
3555+
with pytest.raises(NotImplementedError):
3556+
r.memory_doctor()
3557+
35383558
@skip_if_server_version_lt('4.0.0')
35393559
def test_memory_malloc_stats(self, r):
35403560
assert r.memory_malloc_stats()

0 commit comments

Comments
 (0)