Skip to content
Merged
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
16 changes: 12 additions & 4 deletions tests/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,17 @@ def test_batch_promise_all(cluster):


def test_execute_commands(cluster):
TestScript = Script(None, 'return {KEYS, ARGV}')

assert not TestScript.sha
TestScript = Script(
cluster.get_local_client(0),
'return {KEYS, ARGV}',
)

# XXX: redis<2.10.6 didn't require that a ``Script`` be instantiated with a
# valid client as part of the constructor, which resulted in the SHA not
# actually being set until the script was executed. To ensure the legacy
# behavior still works, we manually unset the cached SHA before executing.
actual_script_hash = TestScript.sha
TestScript.sha = None

results = cluster.execute_commands({
'foo': [
Expand All @@ -249,7 +257,7 @@ def test_execute_commands(cluster):
],
})

assert TestScript.sha
assert TestScript.sha == actual_script_hash

assert results['foo'][0].value
assert results['foo'][1].value == [['key'], ['value']]
Expand Down