Skip to content
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

INFO - add support for taking multiple section arguments #2145

Merged
merged 3 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,9 @@ def select(self, index: int, **kwargs) -> ResponseT:
"""
return self.execute_command("SELECT", index, **kwargs)

def info(self, section: Union[str, None] = None, **kwargs) -> ResponseT:
def info(
self, section: Union[str, None] = None, *args: List[str], **kwargs
) -> ResponseT:
"""
Returns a dictionary containing information about the Redis server

Expand All @@ -899,7 +901,7 @@ def info(self, section: Union[str, None] = None, **kwargs) -> ResponseT:
if section is None:
return self.execute_command("INFO", **kwargs)
else:
return self.execute_command("INFO", section, **kwargs)
return self.execute_command("INFO", section, *args, **kwargs)

def lastsave(self, **kwargs) -> ResponseT:
"""
Expand Down
8 changes: 8 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,14 @@ def test_info(self, r):
assert "arch_bits" in info.keys()
assert "redis_version" in info.keys()

@pytest.mark.onlynoncluster
@skip_if_server_version_lt("7.0.0")
def test_info_multi_sections(self, r):
res = r.info("clients", "server")
assert isinstance(res, dict)
assert "redis_version" in res
assert "connected_clients" in res

@pytest.mark.onlynoncluster
@skip_if_redis_enterprise()
def test_lastsave(self, r):
Expand Down