Skip to content

Raising NotImplementedError for certain LATENC commands #2501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,34 @@ def lastsave(self, **kwargs) -> ResponseT:
"""
return self.execute_command("LASTSAVE", **kwargs)

def latency_doctor(self):
"""Raise a NotImplementedError, as the client will not support LATENCY DOCTOR.
This funcion is best used within the redis-cli.

For more information see https://redis.io/commands/latency-doctor
"""
raise NotImplementedError(
"""
LATENCY DOCTOR is intentionally not implemented in the client.

For more information see https://redis.io/commands/latency-doctor
"""
)

def latency_graph(self):
"""Raise a NotImplementedError, as the client will not support LATENCY GRAPH.
This funcion is best used within the redis-cli.

For more information see https://redis.io/commands/latency-graph.
"""
raise NotImplementedError(
"""
LATENCY GRAPH is intentionally not implemented in the client.

For more information see https://redis.io/commands/latency-graph
"""
)

def lolwut(self, *version_numbers: Union[str, float], **kwargs) -> ResponseT:
"""
Get the Redis version and a piece of generative computer art
Expand Down
10 changes: 10 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4527,6 +4527,16 @@ def test_latency_histogram_not_implemented(self, r: redis.Redis):
with pytest.raises(NotImplementedError):
r.latency_histogram()

@skip_if_server_version_lt("7.0.0")
def test_latency_graph_not_implemented(self, r: redis.Redis):
with pytest.raises(NotImplementedError):
r.latency_graph()

@skip_if_server_version_lt("7.0.0")
def test_latency_doctor_not_implemented(self, r: redis.Redis):
with pytest.raises(NotImplementedError):
r.latency_doctor()

@pytest.mark.onlynoncluster
@skip_if_server_version_lt("4.0.0")
@skip_if_redis_enterprise()
Expand Down