Skip to content

Commit 093309d

Browse files
committed
Supporting args with MODULE LOAD
Part of redis#1546
1 parent 491c938 commit 093309d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Diff for: redis/commands.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3081,12 +3081,14 @@ def _geosearchgeneric(self, command, *args, **kwargs):
30813081
return self.execute_command(command, *pieces, **kwargs)
30823082

30833083
# MODULE COMMANDS
3084-
def module_load(self, path):
3084+
def module_load(self, path, *args):
30853085
"""
30863086
Loads the module from ``path``.
30873087
Raises ``ModuleError`` if a module is not found at ``path``.
30883088
"""
3089-
return self.execute_command('MODULE LOAD', path)
3089+
pieces = list(args)
3090+
pieces.insert(0, path)
3091+
return self.execute_command('MODULE LOAD', *pieces)
30903092

30913093
def module_unload(self, name):
30923094
"""

Diff for: tests/test_commands.py

+10
Original file line numberDiff line numberDiff line change
@@ -3461,6 +3461,16 @@ def test_command_count(self, r):
34613461
assert isinstance(res, int)
34623462
assert res >= 100
34633463

3464+
@skip_if_server_version_lt('4.0.0')
3465+
def test_module(self, r):
3466+
with pytest.raises(redis.exceptions.ModuleError) as excinfo:
3467+
r.module_load('/some/fake/path')
3468+
assert "Error loading the extension." in str(excinfo.value)
3469+
3470+
with pytest.raises(redis.exceptions.ModuleError) as excinfo:
3471+
r.module_load('/some/fake/path', 'arg1', 'arg2', 'arg3', 'arg4')
3472+
assert "Error loading the extension." in str(excinfo.value)
3473+
34643474

34653475
class TestBinarySave:
34663476

0 commit comments

Comments
 (0)