summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChayim <chayim@users.noreply.github.com>2021-09-30 13:35:10 +0300
committerGitHub <noreply@github.com>2021-09-30 13:35:10 +0300
commit6c70fcdd10cca7de15175a77824009babfac4417 (patch)
treea2143f99e26d2304cd433f9f358f0128ef4e1bc7 /tests
parentbfc4cd92c8070de9bfa7736ef21b44eb6fe35ed9 (diff)
downloadredis-py-6c70fcdd10cca7de15175a77824009babfac4417.tar.gz
CLIENT REPLY support, available since redis 3.2.0 (#1581)
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py6
-rw-r--r--tests/test_commands.py13
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index fe304c2..b9091a9 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -101,6 +101,12 @@ def r(request):
@pytest.fixture()
+def r_timeout(request):
+ with _get_client(redis.Redis, request, socket_timeout=1) as client:
+ yield client
+
+
+@pytest.fixture()
def r2(request):
"A second client for tests that need multiple"
with _get_client(redis.Redis, request) as client:
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 7b6f55e..a283afc 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -478,6 +478,19 @@ class TestRedisCommands:
def test_client_unpause(self, r):
assert r.client_unpause() == b'OK'
+ @skip_if_server_version_lt('3.2.0')
+ def test_client_reply(self, r, r_timeout):
+ assert r_timeout.client_reply('ON') == b'OK'
+ with pytest.raises(exceptions.TimeoutError):
+ r_timeout.client_reply('OFF')
+
+ r_timeout.client_reply('SKIP')
+
+ assert r_timeout.set('foo', 'bar')
+
+ # validate it was set
+ assert r.get('foo') == b'bar'
+
def test_config_get(self, r):
data = r.config_get()
assert 'maxmemory' in data