Skip to content
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
6 changes: 4 additions & 2 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3081,12 +3081,14 @@ def _geosearchgeneric(self, command, *args, **kwargs):
return self.execute_command(command, *pieces, **kwargs)

# MODULE COMMANDS
def module_load(self, path):
def module_load(self, path, *args):
"""
Loads the module from ``path``.
Raises ``ModuleError`` if a module is not found at ``path``.
"""
return self.execute_command('MODULE LOAD', path)
pieces = list(args)
pieces.insert(0, path)
return self.execute_command('MODULE LOAD', *pieces)

def module_unload(self, name):
"""
Expand Down
10 changes: 10 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3461,6 +3461,16 @@ def test_command_count(self, r):
assert isinstance(res, int)
assert res >= 100

@skip_if_server_version_lt('4.0.0')
def test_module(self, r):
with pytest.raises(redis.exceptions.ModuleError) as excinfo:
r.module_load('/some/fake/path')
assert "Error loading the extension." in str(excinfo.value)

with pytest.raises(redis.exceptions.ModuleError) as excinfo:
r.module_load('/some/fake/path', 'arg1', 'arg2', 'arg3', 'arg4')
assert "Error loading the extension." in str(excinfo.value)


class TestBinarySave:

Expand Down