Skip to content

Commit 3a121be

Browse files
authored
Intentional NotImplementedError for LATENCY commands that should not be in client (redis#2501)
1 parent 6219574 commit 3a121be

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

redis/commands/core.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,34 @@ def lastsave(self, **kwargs) -> ResponseT:
980980
"""
981981
return self.execute_command("LASTSAVE", **kwargs)
982982

983+
def latency_doctor(self):
984+
"""Raise a NotImplementedError, as the client will not support LATENCY DOCTOR.
985+
This funcion is best used within the redis-cli.
986+
987+
For more information see https://redis.io/commands/latency-doctor
988+
"""
989+
raise NotImplementedError(
990+
"""
991+
LATENCY DOCTOR is intentionally not implemented in the client.
992+
993+
For more information see https://redis.io/commands/latency-doctor
994+
"""
995+
)
996+
997+
def latency_graph(self):
998+
"""Raise a NotImplementedError, as the client will not support LATENCY GRAPH.
999+
This funcion is best used within the redis-cli.
1000+
1001+
For more information see https://redis.io/commands/latency-graph.
1002+
"""
1003+
raise NotImplementedError(
1004+
"""
1005+
LATENCY GRAPH is intentionally not implemented in the client.
1006+
1007+
For more information see https://redis.io/commands/latency-graph
1008+
"""
1009+
)
1010+
9831011
def lolwut(self, *version_numbers: Union[str, float], **kwargs) -> ResponseT:
9841012
"""
9851013
Get the Redis version and a piece of generative computer art

tests/test_commands.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4527,6 +4527,16 @@ def test_latency_histogram_not_implemented(self, r: redis.Redis):
45274527
with pytest.raises(NotImplementedError):
45284528
r.latency_histogram()
45294529

4530+
@skip_if_server_version_lt("7.0.0")
4531+
def test_latency_graph_not_implemented(self, r: redis.Redis):
4532+
with pytest.raises(NotImplementedError):
4533+
r.latency_graph()
4534+
4535+
@skip_if_server_version_lt("7.0.0")
4536+
def test_latency_doctor_not_implemented(self, r: redis.Redis):
4537+
with pytest.raises(NotImplementedError):
4538+
r.latency_doctor()
4539+
45304540
@pytest.mark.onlynoncluster
45314541
@skip_if_server_version_lt("4.0.0")
45324542
@skip_if_redis_enterprise()

0 commit comments

Comments
 (0)