Skip to content

Commit a696fe5

Browse files
authored
INFO - add support for taking multiple section arguments (#2145)
* add support for taking multiple section arguments * skip test
1 parent c198612 commit a696fe5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

redis/commands/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,9 @@ def select(self, index: int, **kwargs) -> ResponseT:
900900
"""
901901
return self.execute_command("SELECT", index, **kwargs)
902902

903-
def info(self, section: Union[str, None] = None, **kwargs) -> ResponseT:
903+
def info(
904+
self, section: Union[str, None] = None, *args: List[str], **kwargs
905+
) -> ResponseT:
904906
"""
905907
Returns a dictionary containing information about the Redis server
906908
@@ -915,7 +917,7 @@ def info(self, section: Union[str, None] = None, **kwargs) -> ResponseT:
915917
if section is None:
916918
return self.execute_command("INFO", **kwargs)
917919
else:
918-
return self.execute_command("INFO", section, **kwargs)
920+
return self.execute_command("INFO", section, *args, **kwargs)
919921

920922
def lastsave(self, **kwargs) -> ResponseT:
921923
"""

tests/test_commands.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,14 @@ def test_info(self, r):
727727
assert "arch_bits" in info.keys()
728728
assert "redis_version" in info.keys()
729729

730+
@pytest.mark.onlynoncluster
731+
@skip_if_server_version_lt("7.0.0")
732+
def test_info_multi_sections(self, r):
733+
res = r.info("clients", "server")
734+
assert isinstance(res, dict)
735+
assert "redis_version" in res
736+
assert "connected_clients" in res
737+
730738
@pytest.mark.onlynoncluster
731739
@skip_if_redis_enterprise()
732740
def test_lastsave(self, r):

0 commit comments

Comments
 (0)