summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChayim <chayim@users.noreply.github.com>2021-11-09 11:24:48 +0200
committerGitHub <noreply@github.com>2021-11-09 11:24:48 +0200
commit599f5a991eda770799a1aea23848b1442019deeb (patch)
tree58dedbde03bb1671dbdf0100159e25353b466ef3 /tests
parentfea7b85dde375a228f485d27737de66592b28848 (diff)
downloadredis-py-599f5a991eda770799a1aea23848b1442019deeb.tar.gz
Re-enable pipeline support for JSON and TimeSeries (#1674)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_json.py32
-rw-r--r--tests/test_timeseries.py31
2 files changed, 35 insertions, 28 deletions
diff --git a/tests/test_json.py b/tests/test_json.py
index 19b0c32..b3f38f7 100644
--- a/tests/test_json.py
+++ b/tests/test_json.py
@@ -275,16 +275,28 @@ def test_objlen(client):
assert len(obj) == client.json().objlen("obj")
-# @pytest.mark.pipeline
-# @pytest.mark.redismod
-# def test_pipelineshouldsucceed(client):
-# p = client.json().pipeline()
-# p.set("foo", Path.rootPath(), "bar")
-# p.get("foo")
-# p.delete("foo")
-# assert [True, "bar", 1] == p.execute()
-# assert client.keys() == []
-# assert client.get("foo") is None
+@pytest.mark.pipeline
+@pytest.mark.redismod
+def test_json_commands_in_pipeline(client):
+ p = client.json().pipeline()
+ p.set("foo", Path.rootPath(), "bar")
+ p.get("foo")
+ p.delete("foo")
+ assert [True, "bar", 1] == p.execute()
+ assert client.keys() == []
+ assert client.get("foo") is None
+
+ # now with a true, json object
+ client.flushdb()
+ p = client.json().pipeline()
+ d = {"hello": "world", "oh": "snap"}
+ p.jsonset("foo", Path.rootPath(), d)
+ p.jsonget("foo")
+ p.exists("notarealkey")
+ p.delete("foo")
+ assert [True, d, 0, 1] == p.execute()
+ assert client.keys() == []
+ assert client.get("foo") is None
@pytest.mark.redismod
diff --git a/tests/test_timeseries.py b/tests/test_timeseries.py
index b2df3fe..d3d474f 100644
--- a/tests/test_timeseries.py
+++ b/tests/test_timeseries.py
@@ -49,10 +49,6 @@ def testAlter(client):
assert 10 == client.ts().info(1).retention_msecs
-# pipe = client.ts().pipeline()
-# assert pipe.create(2)
-
-
@pytest.mark.redismod
@skip_ifmodversion_lt("1.4.0", "timeseries")
def testAlterDiplicatePolicy(client):
@@ -568,20 +564,19 @@ def testQueryIndex(client):
assert [2] == client.ts().queryindex(["Taste=That"])
-#
-# @pytest.mark.redismod
-# @pytest.mark.pipeline
-# def testPipeline(client):
-# pipeline = client.ts().pipeline()
-# pipeline.create("with_pipeline")
-# for i in range(100):
-# pipeline.add("with_pipeline", i, 1.1 * i)
-# pipeline.execute()
-
-# info = client.ts().info("with_pipeline")
-# assert info.lastTimeStamp == 99
-# assert info.total_samples == 100
-# assert client.ts().get("with_pipeline")[1] == 99 * 1.1
+@pytest.mark.redismod
+@pytest.mark.pipeline
+def test_pipeline(client):
+ pipeline = client.ts().pipeline()
+ pipeline.create("with_pipeline")
+ for i in range(100):
+ pipeline.add("with_pipeline", i, 1.1 * i)
+ pipeline.execute()
+
+ info = client.ts().info("with_pipeline")
+ assert info.lastTimeStamp == 99
+ assert info.total_samples == 100
+ assert client.ts().get("with_pipeline")[1] == 99 * 1.1
@pytest.mark.redismod