summaryrefslogtreecommitdiff
path: root/tests/test_scripting.py
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-02-02 13:25:42 +0200
committerGitHub <noreply@github.com>2022-02-02 13:25:42 +0200
commit58b28e43410b8e6e554de8f082f83a5835b075a6 (patch)
tree145e61bd03b2e35179bd6963176fed43d357a1c9 /tests/test_scripting.py
parente37ebd5f399c294dc7d886448eba62065778f7e9 (diff)
downloadredis-py-58b28e43410b8e6e554de8f082f83a5835b075a6.tar.gz
Add support for EVAL_RO (#1862)
* add sort_ro * mark test as onlynon cluster * delete mark test as onlynoncluster * add eval_ro * fix linters * delete sort_ro * fix pr comment * add type hints * add type hints * linters
Diffstat (limited to 'tests/test_scripting.py')
-rw-r--r--tests/test_scripting.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_scripting.py b/tests/test_scripting.py
index 9f4f820..b0d76c7 100644
--- a/tests/test_scripting.py
+++ b/tests/test_scripting.py
@@ -1,5 +1,6 @@
import pytest
+import redis
from redis import exceptions
from tests.conftest import skip_if_server_version_lt
@@ -31,6 +32,13 @@ class TestScripting:
# 2 * 3 == 6
assert r.eval(multiply_script, 1, "a", 3) == 6
+ # @skip_if_server_version_lt("7.0.0") turn on after redis 7 release
+ def test_eval_ro(self, unstable_r):
+ unstable_r.set("a", "b")
+ assert unstable_r.eval_ro("return redis.call('GET', KEYS[1])", 1, "a") == b"b"
+ with pytest.raises(redis.ResponseError):
+ unstable_r.eval_ro("return redis.call('DEL', KEYS[1])", 1, "a")
+
@skip_if_server_version_lt("6.2.0")
def test_script_flush_620(self, r):
r.set("a", 2)