From 6c743a9930a588c938f617d53731ff082a51f66a Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 00:22:19 +0300 Subject: [PATCH 01/12] Add modules to cluster ci --- tests/test_asyncio/test_bloom.py | 26 +------------ tests/test_asyncio/test_graph.py | 20 ---------- tests/test_asyncio/test_json.py | 45 +--------------------- tests/test_asyncio/test_timeseries.py | 25 +----------- tests/test_bloom.py | 27 +------------ tests/test_graph.py | 22 ----------- tests/test_json.py | 55 +-------------------------- tests/test_timeseries.py | 33 ---------------- 8 files changed, 6 insertions(+), 247 deletions(-) diff --git a/tests/test_asyncio/test_bloom.py b/tests/test_asyncio/test_bloom.py index 0535ddfe02..b2f0b4337a 100644 --- a/tests/test_asyncio/test_bloom.py +++ b/tests/test_asyncio/test_bloom.py @@ -15,7 +15,6 @@ def intlist(obj): return [int(v) for v in obj] -@pytest.mark.redismod async def test_create(decoded_r: redis.Redis): """Test CREATE/RESERVE calls""" assert await decoded_r.bf().create("bloom", 0.01, 1000) @@ -30,13 +29,11 @@ async def test_create(decoded_r: redis.Redis): assert await decoded_r.topk().reserve("topk", 5, 100, 5, 0.9) -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_create(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 100) -@pytest.mark.redismod async def test_bf_add(decoded_r: redis.Redis): assert await decoded_r.bf().create("bloom", 0.01, 1000) assert 1 == await decoded_r.bf().add("bloom", "foo") @@ -49,7 +46,6 @@ async def test_bf_add(decoded_r: redis.Redis): assert [1, 0] == intlist(await decoded_r.bf().mexists("bloom", "foo", "noexist")) -@pytest.mark.redismod async def test_bf_insert(decoded_r: redis.Redis): assert await decoded_r.bf().create("bloom", 0.01, 1000) assert [1] == intlist(await decoded_r.bf().insert("bloom", ["foo"])) @@ -80,7 +76,6 @@ async def test_bf_insert(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_bf_scandump_and_loadchunk(decoded_r: redis.Redis): # Store a filter await decoded_r.bf().create("myBloom", "0.0001", "1000") @@ -132,7 +127,6 @@ async def do_verify(): await decoded_r.bf().create("myBloom", "0.0001", "10000000") -@pytest.mark.redismod async def test_bf_info(decoded_r: redis.Redis): expansion = 4 # Store a filter @@ -164,7 +158,6 @@ async def test_bf_info(decoded_r: redis.Redis): assert True -@pytest.mark.redismod async def test_bf_card(decoded_r: redis.Redis): # return 0 if the key does not exist assert await decoded_r.bf().card("not_exist") == 0 @@ -179,7 +172,6 @@ async def test_bf_card(decoded_r: redis.Redis): await decoded_r.bf().card("setKey") -@pytest.mark.redismod async def test_cf_add_and_insert(decoded_r: redis.Redis): assert await decoded_r.cf().create("cuckoo", 1000) assert await decoded_r.cf().add("cuckoo", "filter") @@ -205,7 +197,6 @@ async def test_cf_add_and_insert(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_cf_exists_and_del(decoded_r: redis.Redis): assert await decoded_r.cf().create("cuckoo", 1000) assert await decoded_r.cf().add("cuckoo", "filter") @@ -217,7 +208,6 @@ async def test_cf_exists_and_del(decoded_r: redis.Redis): assert 0 == await decoded_r.cf().count("cuckoo", "filter") -@pytest.mark.redismod async def test_cms(decoded_r: redis.Redis): assert await decoded_r.cms().initbydim("dim", 1000, 5) assert await decoded_r.cms().initbyprob("prob", 0.01, 0.01) @@ -233,7 +223,6 @@ async def test_cms(decoded_r: redis.Redis): assert 25 == info["count"] -@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_cms_merge(decoded_r: redis.Redis): assert await decoded_r.cms().initbydim("A", 1000, 5) @@ -251,7 +240,6 @@ async def test_cms_merge(decoded_r: redis.Redis): assert [16, 15, 21] == await decoded_r.cms().query("C", "foo", "bar", "baz") -@pytest.mark.redismod async def test_topk(decoded_r: redis.Redis): # test list with empty buckets assert await decoded_r.topk().reserve("topk", 3, 50, 4, 0.9) @@ -332,7 +320,6 @@ async def test_topk(decoded_r: redis.Redis): assert 0.9 == round(float(info["decay"]), 1) -@pytest.mark.redismod async def test_topk_incrby(decoded_r: redis.Redis): await decoded_r.flushdb() assert await decoded_r.topk().reserve("topk", 3, 10, 3, 1) @@ -347,7 +334,6 @@ async def test_topk_incrby(decoded_r: redis.Redis): ) -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_reset(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 10) @@ -364,7 +350,6 @@ async def test_tdigest_reset(decoded_r: redis.Redis): ) -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_merge(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("to-tDigest", 10) @@ -392,7 +377,6 @@ async def test_tdigest_merge(decoded_r: redis.Redis): assert 4.0 == await decoded_r.tdigest().max("to-tDigest") -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_min_and_max(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 100) @@ -403,7 +387,6 @@ async def test_tdigest_min_and_max(decoded_r: redis.Redis): assert 1 == await decoded_r.tdigest().min("tDigest") -@pytest.mark.redismod @pytest.mark.experimental @skip_ifmodversion_lt("2.4.0", "bf") async def test_tdigest_quantile(decoded_r: redis.Redis): @@ -432,7 +415,6 @@ async def test_tdigest_quantile(decoded_r: redis.Redis): assert [3.0, 5.0] == res -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_cdf(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 100) @@ -444,7 +426,6 @@ async def test_tdigest_cdf(decoded_r: redis.Redis): assert [0.1, 0.9] == [round(x, 1) for x in res] -@pytest.mark.redismod @pytest.mark.experimental @skip_ifmodversion_lt("2.4.0", "bf") async def test_tdigest_trimmed_mean(decoded_r: redis.Redis): @@ -455,7 +436,6 @@ async def test_tdigest_trimmed_mean(decoded_r: redis.Redis): assert 4.5 == await decoded_r.tdigest().trimmed_mean("tDigest", 0.4, 0.5) -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_rank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -466,7 +446,6 @@ async def test_tdigest_rank(decoded_r: redis.Redis): assert [-1, 20, 9] == await decoded_r.tdigest().rank("t-digest", -20, 20, 9) -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_revrank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -476,7 +455,6 @@ async def test_tdigest_revrank(decoded_r: redis.Redis): assert [-1, 19, 9] == await decoded_r.tdigest().revrank("t-digest", 21, 0, 10) -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_byrank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -488,7 +466,6 @@ async def test_tdigest_byrank(decoded_r: redis.Redis): (await decoded_r.tdigest().byrank("t-digest", -1))[0] -@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_byrevrank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -500,8 +477,7 @@ async def test_tdigest_byrevrank(decoded_r: redis.Redis): (await decoded_r.tdigest().byrevrank("t-digest", -1))[0] -# @pytest.mark.redismod -# async def test_pipeline(decoded_r: redis.Redis): +# # async def test_pipeline(decoded_r: redis.Redis): # pipeline = await decoded_r.bf().pipeline() # assert not await decoded_r.bf().execute_command("get pipeline") # diff --git a/tests/test_asyncio/test_graph.py b/tests/test_asyncio/test_graph.py index 22195901e6..4caf79470e 100644 --- a/tests/test_asyncio/test_graph.py +++ b/tests/test_asyncio/test_graph.py @@ -6,14 +6,12 @@ from tests.conftest import skip_if_redis_enterprise -@pytest.mark.redismod async def test_bulk(decoded_r): with pytest.raises(NotImplementedError): await decoded_r.graph().bulk() await decoded_r.graph().bulk(foo="bar!") -@pytest.mark.redismod async def test_graph_creation(decoded_r: redis.Redis): graph = decoded_r.graph() @@ -58,7 +56,6 @@ async def test_graph_creation(decoded_r: redis.Redis): await graph.delete() -@pytest.mark.redismod async def test_array_functions(decoded_r: redis.Redis): graph = decoded_r.graph() @@ -81,7 +78,6 @@ async def test_array_functions(decoded_r: redis.Redis): assert [a] == result.result_set[0][0] -@pytest.mark.redismod async def test_path(decoded_r: redis.Redis): node0 = Node(node_id=0, label="L1") node1 = Node(node_id=1, label="L1") @@ -101,7 +97,6 @@ async def test_path(decoded_r: redis.Redis): assert expected_results == result.result_set -@pytest.mark.redismod async def test_param(decoded_r: redis.Redis): params = [1, 2.3, "str", True, False, None, [0, 1, 2]] query = "RETURN $param" @@ -111,7 +106,6 @@ async def test_param(decoded_r: redis.Redis): assert expected_results == result.result_set -@pytest.mark.redismod async def test_map(decoded_r: redis.Redis): query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}" @@ -128,7 +122,6 @@ async def test_map(decoded_r: redis.Redis): assert actual == expected -@pytest.mark.redismod async def test_point(decoded_r: redis.Redis): query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})" expected_lat = 32.070794860 @@ -145,7 +138,6 @@ async def test_point(decoded_r: redis.Redis): assert abs(actual["longitude"] - expected_lon) < 0.001 -@pytest.mark.redismod async def test_index_response(decoded_r: redis.Redis): result_set = await decoded_r.graph().query("CREATE INDEX ON :person(age)") assert 1 == result_set.indices_created @@ -160,7 +152,6 @@ async def test_index_response(decoded_r: redis.Redis): await decoded_r.graph().query("DROP INDEX ON :person(age)") -@pytest.mark.redismod async def test_stringify_query_result(decoded_r: redis.Redis): graph = decoded_r.graph() @@ -214,7 +205,6 @@ async def test_stringify_query_result(decoded_r: redis.Redis): await graph.delete() -@pytest.mark.redismod async def test_optional_match(decoded_r: redis.Redis): # Build a graph of form (a)-[R]->(b) node0 = Node(node_id=0, label="L1", properties={"value": "a"}) @@ -239,7 +229,6 @@ async def test_optional_match(decoded_r: redis.Redis): await graph.delete() -@pytest.mark.redismod async def test_cached_execution(decoded_r: redis.Redis): await decoded_r.graph().query("CREATE ()") @@ -259,7 +248,6 @@ async def test_cached_execution(decoded_r: redis.Redis): assert cached_result.cached_execution -@pytest.mark.redismod async def test_slowlog(decoded_r: redis.Redis): create_query = """CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}), @@ -272,7 +260,6 @@ async def test_slowlog(decoded_r: redis.Redis): assert results[0][2] == create_query -@pytest.mark.redismod @pytest.mark.xfail(strict=False) async def test_query_timeout(decoded_r: redis.Redis): # Build a sample graph with 1000 nodes. @@ -287,7 +274,6 @@ async def test_query_timeout(decoded_r: redis.Redis): assert False is False -@pytest.mark.redismod async def test_read_only_query(decoded_r: redis.Redis): with pytest.raises(Exception): # Issue a write query, specifying read-only true, @@ -296,7 +282,6 @@ async def test_read_only_query(decoded_r: redis.Redis): assert False is False -@pytest.mark.redismod async def test_profile(decoded_r: redis.Redis): q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})""" profile = (await decoded_r.graph().profile(q)).result_set @@ -311,7 +296,6 @@ async def test_profile(decoded_r: redis.Redis): assert "Node By Label Scan | (p:Person) | Records produced: 3" in profile -@pytest.mark.redismod @skip_if_redis_enterprise() async def test_config(decoded_r: redis.Redis): config_name = "RESULTSET_SIZE" @@ -343,7 +327,6 @@ async def test_config(decoded_r: redis.Redis): await decoded_r.graph().config("RESULTSET_SIZE", -100, set=True) -@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_list_keys(decoded_r: redis.Redis): result = await decoded_r.graph().list_keys() @@ -367,7 +350,6 @@ async def test_list_keys(decoded_r: redis.Redis): assert result == [] -@pytest.mark.redismod async def test_multi_label(decoded_r: redis.Redis): redis_graph = decoded_r.graph("g") @@ -393,7 +375,6 @@ async def test_multi_label(decoded_r: redis.Redis): assert True -@pytest.mark.redismod async def test_execution_plan(decoded_r: redis.Redis): redis_graph = decoded_r.graph("execution_plan") create_query = """CREATE @@ -412,7 +393,6 @@ async def test_execution_plan(decoded_r: redis.Redis): await redis_graph.delete() -@pytest.mark.redismod async def test_explain(decoded_r: redis.Redis): redis_graph = decoded_r.graph("execution_plan") # graph creation / population diff --git a/tests/test_asyncio/test_json.py b/tests/test_asyncio/test_json.py index 6f3e8c3251..a9cba47734 100644 --- a/tests/test_asyncio/test_json.py +++ b/tests/test_asyncio/test_json.py @@ -5,7 +5,6 @@ from tests.conftest import assert_resp_response, skip_ifmodversion_lt -@pytest.mark.redismod async def test_json_setbinarykey(decoded_r: redis.Redis): d = {"hello": "world", b"some": "value"} with pytest.raises(TypeError): @@ -13,7 +12,6 @@ async def test_json_setbinarykey(decoded_r: redis.Redis): assert await decoded_r.json().set("somekey", Path.root_path(), d, decode_keys=True) -@pytest.mark.redismod async def test_json_setgetdeleteforget(decoded_r: redis.Redis): assert await decoded_r.json().set("foo", Path.root_path(), "bar") assert_resp_response(decoded_r, await decoded_r.json().get("foo"), "bar", [["bar"]]) @@ -23,13 +21,11 @@ async def test_json_setgetdeleteforget(decoded_r: redis.Redis): assert await decoded_r.exists("foo") == 0 -@pytest.mark.redismod async def test_jsonget(decoded_r: redis.Redis): await decoded_r.json().set("foo", Path.root_path(), "bar") assert_resp_response(decoded_r, await decoded_r.json().get("foo"), "bar", [["bar"]]) -@pytest.mark.redismod async def test_json_get_jset(decoded_r: redis.Redis): assert await decoded_r.json().set("foo", Path.root_path(), "bar") assert_resp_response(decoded_r, await decoded_r.json().get("foo"), "bar", [["bar"]]) @@ -38,7 +34,6 @@ async def test_json_get_jset(decoded_r: redis.Redis): assert await decoded_r.exists("foo") == 0 -@pytest.mark.redismod async def test_nonascii_setgetdelete(decoded_r: redis.Redis): assert await decoded_r.json().set("notascii", Path.root_path(), "hyvää-élève") res = "hyvää-élève" @@ -49,7 +44,6 @@ async def test_nonascii_setgetdelete(decoded_r: redis.Redis): assert await decoded_r.exists("notascii") == 0 -@pytest.mark.redismod @skip_ifmodversion_lt("2.6.0", "ReJSON") async def test_json_merge(decoded_r: redis.Redis): # Test with root path $ @@ -84,7 +78,6 @@ async def test_json_merge(decoded_r: redis.Redis): } -@pytest.mark.redismod async def test_jsonsetexistentialmodifiersshouldsucceed(decoded_r: redis.Redis): obj = {"foo": "bar"} assert await decoded_r.json().set("obj", Path.root_path(), obj) @@ -102,7 +95,6 @@ async def test_jsonsetexistentialmodifiersshouldsucceed(decoded_r: redis.Redis): await decoded_r.json().set("obj", Path("foo"), "baz", nx=True, xx=True) -@pytest.mark.redismod async def test_mgetshouldsucceed(decoded_r: redis.Redis): await decoded_r.json().set("1", Path.root_path(), 1) await decoded_r.json().set("2", Path.root_path(), 2) @@ -111,7 +103,6 @@ async def test_mgetshouldsucceed(decoded_r: redis.Redis): assert await decoded_r.json().mget([1, 2], Path.root_path()) == [1, 2] -@pytest.mark.redismod @skip_ifmodversion_lt("2.6.0", "ReJSON") async def test_mset(decoded_r: redis.Redis): await decoded_r.json().mset( @@ -122,7 +113,6 @@ async def test_mset(decoded_r: redis.Redis): assert await decoded_r.json().mget(["1", "2"], Path.root_path()) == [1, 2] -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "ReJSON") # todo: update after the release async def test_clear(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) @@ -130,7 +120,6 @@ async def test_clear(decoded_r: redis.Redis): assert_resp_response(decoded_r, await decoded_r.json().get("arr"), [], [[[]]]) -@pytest.mark.redismod async def test_type(decoded_r: redis.Redis): await decoded_r.json().set("1", Path.root_path(), 1) assert_resp_response( @@ -144,7 +133,6 @@ async def test_type(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_numincrby(decoded_r): await decoded_r.json().set("num", Path.root_path(), 1) assert_resp_response( @@ -156,7 +144,6 @@ async def test_numincrby(decoded_r): assert_resp_response(decoded_r, res, 1.25, [1.25]) -@pytest.mark.redismod async def test_nummultby(decoded_r: redis.Redis): await decoded_r.json().set("num", Path.root_path(), 1) @@ -169,7 +156,6 @@ async def test_nummultby(decoded_r: redis.Redis): assert_resp_response(decoded_r, res, 2.5, [2.5]) -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "ReJSON") # todo: update after the release async def test_toggle(decoded_r: redis.Redis): await decoded_r.json().set("bool", Path.root_path(), False) @@ -181,7 +167,6 @@ async def test_toggle(decoded_r: redis.Redis): await decoded_r.json().toggle("num", Path.root_path()) -@pytest.mark.redismod async def test_strappend(decoded_r: redis.Redis): await decoded_r.json().set("jsonkey", Path.root_path(), "foo") assert 6 == await decoded_r.json().strappend("jsonkey", "bar") @@ -189,7 +174,6 @@ async def test_strappend(decoded_r: redis.Redis): assert_resp_response(decoded_r, res, "foobar", [["foobar"]]) -@pytest.mark.redismod async def test_strlen(decoded_r: redis.Redis): await decoded_r.json().set("str", Path.root_path(), "foo") assert 3 == await decoded_r.json().strlen("str", Path.root_path()) @@ -198,7 +182,6 @@ async def test_strlen(decoded_r: redis.Redis): assert 6 == await decoded_r.json().strlen("str") -@pytest.mark.redismod async def test_arrappend(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [1]) assert 2 == await decoded_r.json().arrappend("arr", Path.root_path(), 2) @@ -206,7 +189,6 @@ async def test_arrappend(decoded_r: redis.Redis): assert 7 == await decoded_r.json().arrappend("arr", Path.root_path(), *[5, 6, 7]) -@pytest.mark.redismod async def test_arrindex(decoded_r: redis.Redis): r_path = Path.root_path() await decoded_r.json().set("arr", r_path, [0, 1, 2, 3, 4]) @@ -219,7 +201,6 @@ async def test_arrindex(decoded_r: redis.Redis): assert -1 == await decoded_r.json().arrindex("arr", r_path, 4, start=1, stop=3) -@pytest.mark.redismod async def test_arrinsert(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 4]) assert 5 == await decoded_r.json().arrinsert("arr", Path.root_path(), 1, *[1, 2, 3]) @@ -233,7 +214,6 @@ async def test_arrinsert(decoded_r: redis.Redis): assert_resp_response(decoded_r, await decoded_r.json().get("val2"), res, [[res]]) -@pytest.mark.redismod async def test_arrlen(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 5 == await decoded_r.json().arrlen("arr", Path.root_path()) @@ -241,7 +221,6 @@ async def test_arrlen(decoded_r: redis.Redis): assert await decoded_r.json().arrlen("fakekey") is None -@pytest.mark.redismod async def test_arrpop(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 4 == await decoded_r.json().arrpop("arr", Path.root_path(), 4) @@ -259,7 +238,6 @@ async def test_arrpop(decoded_r: redis.Redis): assert await decoded_r.json().arrpop("arr") is None -@pytest.mark.redismod async def test_arrtrim(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 3 == await decoded_r.json().arrtrim("arr", Path.root_path(), 1, 3) @@ -283,7 +261,6 @@ async def test_arrtrim(decoded_r: redis.Redis): assert 0 == await decoded_r.json().arrtrim("arr", Path.root_path(), 9, 11) -@pytest.mark.redismod async def test_resp(decoded_r: redis.Redis): obj = {"foo": "bar", "baz": 1, "qaz": True} await decoded_r.json().set("obj", Path.root_path(), obj) @@ -293,7 +270,6 @@ async def test_resp(decoded_r: redis.Redis): assert isinstance(await decoded_r.json().resp("obj"), list) -@pytest.mark.redismod async def test_objkeys(decoded_r: redis.Redis): obj = {"foo": "bar", "baz": "qaz"} await decoded_r.json().set("obj", Path.root_path(), obj) @@ -310,7 +286,6 @@ async def test_objkeys(decoded_r: redis.Redis): assert await decoded_r.json().objkeys("fakekey") is None -@pytest.mark.redismod async def test_objlen(decoded_r: redis.Redis): obj = {"foo": "bar", "baz": "qaz"} await decoded_r.json().set("obj", Path.root_path(), obj) @@ -320,8 +295,7 @@ async def test_objlen(decoded_r: redis.Redis): assert len(obj) == await decoded_r.json().objlen("obj") -# @pytest.mark.redismod -# async def test_json_commands_in_pipeline(decoded_r: redis.Redis): +# # async def test_json_commands_in_pipeline(decoded_r: redis.Redis): # async with decoded_r.json().pipeline() as p: # p.set("foo", Path.root_path(), "bar") # p.get("foo") @@ -344,7 +318,6 @@ async def test_objlen(decoded_r: redis.Redis): # assert await decoded_r.get("foo") is None -@pytest.mark.redismod async def test_json_delete_with_dollar(decoded_r: redis.Redis): doc1 = {"a": 1, "nested": {"a": 2, "b": 3}} assert await decoded_r.json().set("doc1", "$", doc1) @@ -398,7 +371,6 @@ async def test_json_delete_with_dollar(decoded_r: redis.Redis): await decoded_r.json().delete("not_a_document", "..a") -@pytest.mark.redismod async def test_json_forget_with_dollar(decoded_r: redis.Redis): doc1 = {"a": 1, "nested": {"a": 2, "b": 3}} assert await decoded_r.json().set("doc1", "$", doc1) @@ -451,7 +423,6 @@ async def test_json_forget_with_dollar(decoded_r: redis.Redis): await decoded_r.json().forget("not_a_document", "..a") -@pytest.mark.redismod async def test_json_mget_dollar(decoded_r: redis.Redis): # Test mget with multi paths await decoded_r.json().set( @@ -487,7 +458,6 @@ async def test_json_mget_dollar(decoded_r: redis.Redis): assert res == [None, None] -@pytest.mark.redismod async def test_numby_commands_dollar(decoded_r: redis.Redis): # Test NUMINCRBY @@ -543,7 +513,6 @@ async def test_numby_commands_dollar(decoded_r: redis.Redis): await decoded_r.json().nummultby("doc1", ".b[0].a", 3) == 6 -@pytest.mark.redismod async def test_strappend_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -575,7 +544,6 @@ async def test_strappend_dollar(decoded_r: redis.Redis): await decoded_r.json().strappend("doc1", "piu") -@pytest.mark.redismod async def test_strlen_dollar(decoded_r: redis.Redis): # Test multi @@ -597,7 +565,6 @@ async def test_strlen_dollar(decoded_r: redis.Redis): await decoded_r.json().strlen("non_existing_doc", "$..a") -@pytest.mark.redismod async def test_arrappend_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -671,7 +638,6 @@ async def test_arrappend_dollar(decoded_r: redis.Redis): await decoded_r.json().arrappend("non_existing_doc", "$..a") -@pytest.mark.redismod async def test_arrinsert_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -710,7 +676,6 @@ async def test_arrinsert_dollar(decoded_r: redis.Redis): await decoded_r.json().arrappend("non_existing_doc", "$..a") -@pytest.mark.redismod async def test_arrlen_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -757,7 +722,6 @@ async def test_arrlen_dollar(decoded_r: redis.Redis): assert await decoded_r.json().arrlen("non_existing_doc", "..a") is None -@pytest.mark.redismod async def test_arrpop_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -799,7 +763,6 @@ async def test_arrpop_dollar(decoded_r: redis.Redis): await decoded_r.json().arrpop("non_existing_doc", "..a") -@pytest.mark.redismod async def test_arrtrim_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -852,7 +815,6 @@ async def test_arrtrim_dollar(decoded_r: redis.Redis): await decoded_r.json().arrtrim("non_existing_doc", "..a", 1, 1) -@pytest.mark.redismod async def test_objkeys_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -882,7 +844,6 @@ async def test_objkeys_dollar(decoded_r: redis.Redis): assert await decoded_r.json().objkeys("doc1", "$..nowhere") == [] -@pytest.mark.redismod async def test_objlen_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -918,7 +879,6 @@ async def test_objlen_dollar(decoded_r: redis.Redis): await decoded_r.json().objlen("doc1", ".nowhere") -@pytest.mark.redismod def load_types_data(nested_key_name): td = { "object": {}, @@ -938,7 +898,6 @@ def load_types_data(nested_key_name): return jdata, types -@pytest.mark.redismod async def test_type_dollar(decoded_r: redis.Redis): jdata, jtypes = load_types_data("a") await decoded_r.json().set("doc1", "$", jdata) @@ -957,7 +916,6 @@ async def test_type_dollar(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_clear_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -1012,7 +970,6 @@ async def test_clear_dollar(decoded_r: redis.Redis): await decoded_r.json().clear("non_existing_doc", "$..a") -@pytest.mark.redismod async def test_toggle_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", diff --git a/tests/test_asyncio/test_timeseries.py b/tests/test_asyncio/test_timeseries.py index 48ffdfd889..540383b1db 100644 --- a/tests/test_asyncio/test_timeseries.py +++ b/tests/test_asyncio/test_timeseries.py @@ -10,7 +10,6 @@ ) -@pytest.mark.redismod async def test_create(decoded_r: redis.Redis): assert await decoded_r.ts().create(1) assert await decoded_r.ts().create(2, retention_msecs=5) @@ -28,7 +27,6 @@ async def test_create(decoded_r: redis.Redis): assert_resp_response(decoded_r, 128, info.get("chunk_size"), info.get("chunkSize")) -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def test_create_duplicate_policy(decoded_r: redis.Redis): # Test for duplicate policy @@ -44,7 +42,6 @@ async def test_create_duplicate_policy(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_alter(decoded_r: redis.Redis): assert await decoded_r.ts().create(1) res = await decoded_r.ts().info(1) @@ -67,7 +64,6 @@ async def test_alter(decoded_r: redis.Redis): ) -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def test_alter_diplicate_policy(decoded_r: redis.Redis): assert await decoded_r.ts().create(1) @@ -82,7 +78,6 @@ async def test_alter_diplicate_policy(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_add(decoded_r: redis.Redis): assert 1 == await decoded_r.ts().add(1, 1, 1) assert 2 == await decoded_r.ts().add(2, 2, 3, retention_msecs=10) @@ -105,7 +100,6 @@ async def test_add(decoded_r: redis.Redis): assert_resp_response(decoded_r, 128, info.get("chunk_size"), info.get("chunkSize")) -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def test_add_duplicate_policy(r: redis.Redis): @@ -147,7 +141,6 @@ async def test_add_duplicate_policy(r: redis.Redis): assert 5.0 == res[1] -@pytest.mark.redismod async def test_madd(decoded_r: redis.Redis): await decoded_r.ts().create("a") assert [1, 2, 3] == await decoded_r.ts().madd( @@ -155,7 +148,6 @@ async def test_madd(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_incrby_decrby(decoded_r: redis.Redis): for _ in range(100): assert await decoded_r.ts().incrby(1, 1) @@ -184,7 +176,6 @@ async def test_incrby_decrby(decoded_r: redis.Redis): assert_resp_response(decoded_r, 128, info.get("chunk_size"), info.get("chunkSize")) -@pytest.mark.redismod async def test_create_and_delete_rule(decoded_r: redis.Redis): # test rule creation time = 100 @@ -208,7 +199,6 @@ async def test_create_and_delete_rule(decoded_r: redis.Redis): assert not info["rules"] -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_del_range(decoded_r: redis.Redis): try: @@ -225,7 +215,6 @@ async def test_del_range(decoded_r: redis.Redis): ) -@pytest.mark.redismod async def test_range(r: redis.Redis): for i in range(100): await r.ts().add(1, i, i % 7) @@ -240,7 +229,6 @@ async def test_range(r: redis.Redis): assert 10 == len(await r.ts().range(1, 0, 500, count=10)) -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_range_advanced(decoded_r: redis.Redis): for i in range(100): @@ -271,7 +259,6 @@ async def test_range_advanced(decoded_r: redis.Redis): assert_resp_response(decoded_r, res, [(0, 2.55), (10, 3.0)], [[0, 2.55], [10, 3.0]]) -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_rev_range(decoded_r: redis.Redis): for i in range(100): @@ -315,7 +302,6 @@ async def test_rev_range(decoded_r: redis.Redis): ) -@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_multi_range(decoded_r: redis.Redis): await decoded_r.ts().create(1, labels={"Test": "This", "team": "ny"}) @@ -370,7 +356,6 @@ async def test_multi_range(decoded_r: redis.Redis): assert {"Test": "This", "team": "ny"} == res["1"][0] -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_multi_range_advanced(decoded_r: redis.Redis): @@ -488,7 +473,6 @@ async def test_multi_range_advanced(decoded_r: redis.Redis): assert [[0, 5.0], [5, 6.0]] == res["1"][2] -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_multi_reverse_range(decoded_r: redis.Redis): @@ -652,7 +636,6 @@ async def test_multi_reverse_range(decoded_r: redis.Redis): assert [[1, 10.0], [0, 1.0]] == res["1"][2] -@pytest.mark.redismod async def test_get(decoded_r: redis.Redis): name = "test" await decoded_r.ts().create(name) @@ -663,7 +646,6 @@ async def test_get(decoded_r: redis.Redis): assert 4 == (await decoded_r.ts().get(name))[1] -@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_mget(decoded_r: redis.Redis): await decoded_r.ts().create(1, labels={"Test": "This"}) @@ -699,7 +681,6 @@ async def test_mget(decoded_r: redis.Redis): assert {"Taste": "That", "Test": "This"} == res["2"][0] -@pytest.mark.redismod async def test_info(decoded_r: redis.Redis): await decoded_r.ts().create( 1, retention_msecs=5, labels={"currentLabel": "currentData"} @@ -711,7 +692,6 @@ async def test_info(decoded_r: redis.Redis): assert info["labels"]["currentLabel"] == "currentData" -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def testInfoDuplicatePolicy(decoded_r: redis.Redis): await decoded_r.ts().create( @@ -729,7 +709,6 @@ async def testInfoDuplicatePolicy(decoded_r: redis.Redis): ) -@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_query_index(decoded_r: redis.Redis): await decoded_r.ts().create(1, labels={"Test": "This"}) @@ -741,8 +720,7 @@ async def test_query_index(decoded_r: redis.Redis): ) -# @pytest.mark.redismod -# async def test_pipeline(r: redis.Redis): +# # async def test_pipeline(r: redis.Redis): # pipeline = await r.ts().pipeline() # pipeline.create("with_pipeline") # for i in range(100): @@ -755,7 +733,6 @@ async def test_query_index(decoded_r: redis.Redis): # assert await r.ts().get("with_pipeline")[1] == 99 * 1.1 -@pytest.mark.redismod async def test_uncompressed(decoded_r: redis.Redis): await decoded_r.ts().create("compressed") await decoded_r.ts().create("uncompressed", uncompressed=True) diff --git a/tests/test_bloom.py b/tests/test_bloom.py index a82fece470..f049f7fa3f 100644 --- a/tests/test_bloom.py +++ b/tests/test_bloom.py @@ -24,7 +24,6 @@ def client(decoded_r): return decoded_r -@pytest.mark.redismod def test_create(client): """Test CREATE/RESERVE calls""" assert client.bf().create("bloom", 0.01, 1000) @@ -39,7 +38,6 @@ def test_create(client): assert client.topk().reserve("topk", 5, 100, 5, 0.9) -@pytest.mark.redismod def test_bf_reserve(client): """Testing BF.RESERVE""" assert client.bf().reserve("bloom", 0.01, 1000) @@ -54,13 +52,11 @@ def test_bf_reserve(client): assert client.topk().reserve("topk", 5, 100, 5, 0.9) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_create(client): assert client.tdigest().create("tDigest", 100) -@pytest.mark.redismod def test_bf_add(client): assert client.bf().create("bloom", 0.01, 1000) assert 1 == client.bf().add("bloom", "foo") @@ -73,7 +69,6 @@ def test_bf_add(client): assert [1, 0] == intlist(client.bf().mexists("bloom", "foo", "noexist")) -@pytest.mark.redismod def test_bf_insert(client): assert client.bf().create("bloom", 0.01, 1000) assert [1] == intlist(client.bf().insert("bloom", ["foo"])) @@ -104,7 +99,6 @@ def test_bf_insert(client): ) -@pytest.mark.redismod def test_bf_scandump_and_loadchunk(client): # Store a filter client.bf().create("myBloom", "0.0001", "1000") @@ -156,7 +150,6 @@ def do_verify(): client.bf().create("myBloom", "0.0001", "10000000") -@pytest.mark.redismod def test_bf_info(client): expansion = 4 # Store a filter @@ -188,7 +181,6 @@ def test_bf_info(client): assert True -@pytest.mark.redismod def test_bf_card(client): # return 0 if the key does not exist assert client.bf().card("not_exist") == 0 @@ -203,7 +195,6 @@ def test_bf_card(client): client.bf().card("setKey") -@pytest.mark.redismod def test_cf_add_and_insert(client): assert client.cf().create("cuckoo", 1000) assert client.cf().add("cuckoo", "filter") @@ -229,7 +220,6 @@ def test_cf_add_and_insert(client): ) -@pytest.mark.redismod def test_cf_exists_and_del(client): assert client.cf().create("cuckoo", 1000) assert client.cf().add("cuckoo", "filter") @@ -242,7 +232,6 @@ def test_cf_exists_and_del(client): assert 0 == client.cf().count("cuckoo", "filter") -@pytest.mark.redismod def test_cms(client): assert client.cms().initbydim("dim", 1000, 5) assert client.cms().initbyprob("prob", 0.01, 0.01) @@ -258,7 +247,6 @@ def test_cms(client): assert 25 == info["count"] -@pytest.mark.redismod @pytest.mark.onlynoncluster def test_cms_merge(client): assert client.cms().initbydim("A", 1000, 5) @@ -276,7 +264,6 @@ def test_cms_merge(client): assert [16, 15, 21] == client.cms().query("C", "foo", "bar", "baz") -@pytest.mark.redismod def test_topk(client): # test list with empty buckets assert client.topk().reserve("topk", 3, 50, 4, 0.9) @@ -356,7 +343,6 @@ def test_topk(client): assert 0.9 == round(float(info["decay"]), 1) -@pytest.mark.redismod def test_topk_incrby(client): client.flushdb() assert client.topk().reserve("topk", 3, 10, 3, 1) @@ -370,7 +356,6 @@ def test_topk_incrby(client): ) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_reset(client): assert client.tdigest().create("tDigest", 10) @@ -387,7 +372,6 @@ def test_tdigest_reset(client): ) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_merge(client): assert client.tdigest().create("to-tDigest", 10) @@ -415,7 +399,6 @@ def test_tdigest_merge(client): assert 4.0 == client.tdigest().max("to-tDigest") -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_min_and_max(client): assert client.tdigest().create("tDigest", 100) @@ -426,7 +409,6 @@ def test_tdigest_min_and_max(client): assert 1 == client.tdigest().min("tDigest") -@pytest.mark.redismod @pytest.mark.experimental @skip_ifmodversion_lt("2.4.0", "bf") def test_tdigest_quantile(client): @@ -448,7 +430,6 @@ def test_tdigest_quantile(client): assert [3.0, 5.0] == client.tdigest().quantile("t-digest", 0.5, 0.8) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_cdf(client): assert client.tdigest().create("tDigest", 100) @@ -460,7 +441,6 @@ def test_tdigest_cdf(client): assert [0.1, 0.9] == [round(x, 1) for x in res] -@pytest.mark.redismod @pytest.mark.experimental @skip_ifmodversion_lt("2.4.0", "bf") def test_tdigest_trimmed_mean(client): @@ -471,7 +451,6 @@ def test_tdigest_trimmed_mean(client): assert 4.5 == client.tdigest().trimmed_mean("tDigest", 0.4, 0.5) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_rank(client): assert client.tdigest().create("t-digest", 500) @@ -482,7 +461,6 @@ def test_tdigest_rank(client): assert [-1, 20, 9] == client.tdigest().rank("t-digest", -20, 20, 9) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_revrank(client): assert client.tdigest().create("t-digest", 500) @@ -492,7 +470,6 @@ def test_tdigest_revrank(client): assert [-1, 19, 9] == client.tdigest().revrank("t-digest", 21, 0, 10) -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_byrank(client): assert client.tdigest().create("t-digest", 500) @@ -504,7 +481,6 @@ def test_tdigest_byrank(client): client.tdigest().byrank("t-digest", -1)[0] -@pytest.mark.redismod @pytest.mark.experimental def test_tdigest_byrevrank(client): assert client.tdigest().create("t-digest", 500) @@ -516,8 +492,7 @@ def test_tdigest_byrevrank(client): client.tdigest().byrevrank("t-digest", -1)[0] -# @pytest.mark.redismod -# def test_pipeline(client): +# # def test_pipeline(client): # pipeline = client.bf().pipeline() # assert not client.bf().execute_command("get pipeline") # diff --git a/tests/test_graph.py b/tests/test_graph.py index 42f1d9e5df..6fa9977d98 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -30,14 +30,12 @@ def client(request): return r -@pytest.mark.redismod def test_bulk(client): with pytest.raises(NotImplementedError): client.graph().bulk() client.graph().bulk(foo="bar!") -@pytest.mark.redismod def test_graph_creation(client): graph = client.graph() @@ -82,7 +80,6 @@ def test_graph_creation(client): graph.delete() -@pytest.mark.redismod def test_array_functions(client): query = """CREATE (p:person{name:'a',age:32, array:[0,1,2]})""" client.graph().query(query) @@ -103,7 +100,6 @@ def test_array_functions(client): assert [a] == result.result_set[0][0] -@pytest.mark.redismod def test_path(client): node0 = Node(node_id=0, label="L1") node1 = Node(node_id=1, label="L1") @@ -123,7 +119,6 @@ def test_path(client): assert expected_results == result.result_set -@pytest.mark.redismod def test_param(client): params = [1, 2.3, "str", True, False, None, [0, 1, 2], r"\" RETURN 1337 //"] query = "RETURN $param" @@ -133,7 +128,6 @@ def test_param(client): assert expected_results == result.result_set -@pytest.mark.redismod def test_map(client): query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}" @@ -150,7 +144,6 @@ def test_map(client): assert actual == expected -@pytest.mark.redismod def test_point(client): query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})" expected_lat = 32.070794860 @@ -167,7 +160,6 @@ def test_point(client): assert abs(actual["longitude"] - expected_lon) < 0.001 -@pytest.mark.redismod def test_index_response(client): result_set = client.graph().query("CREATE INDEX ON :person(age)") assert 1 == result_set.indices_created @@ -182,7 +174,6 @@ def test_index_response(client): client.graph().query("DROP INDEX ON :person(age)") -@pytest.mark.redismod def test_stringify_query_result(client): graph = client.graph() @@ -236,7 +227,6 @@ def test_stringify_query_result(client): graph.delete() -@pytest.mark.redismod def test_optional_match(client): # Build a graph of form (a)-[R]->(b) node0 = Node(node_id=0, label="L1", properties={"value": "a"}) @@ -261,7 +251,6 @@ def test_optional_match(client): graph.delete() -@pytest.mark.redismod def test_cached_execution(client): client.graph().query("CREATE ()") @@ -279,7 +268,6 @@ def test_cached_execution(client): assert cached_result.cached_execution -@pytest.mark.redismod def test_slowlog(client): create_query = """CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}), @@ -292,7 +280,6 @@ def test_slowlog(client): assert results[0][2] == create_query -@pytest.mark.redismod @pytest.mark.xfail(strict=False) def test_query_timeout(client): # Build a sample graph with 1000 nodes. @@ -307,7 +294,6 @@ def test_query_timeout(client): assert False is False -@pytest.mark.redismod def test_read_only_query(client): with pytest.raises(Exception): # Issue a write query, specifying read-only true, @@ -316,7 +302,6 @@ def test_read_only_query(client): assert False is False -@pytest.mark.redismod def test_profile(client): q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})""" profile = client.graph().profile(q).result_set @@ -331,7 +316,6 @@ def test_profile(client): assert "Node By Label Scan | (p:Person) | Records produced: 3" in profile -@pytest.mark.redismod @skip_if_redis_enterprise() def test_config(client): config_name = "RESULTSET_SIZE" @@ -363,7 +347,6 @@ def test_config(client): client.graph().config("RESULTSET_SIZE", -100, set=True) -@pytest.mark.redismod @pytest.mark.onlynoncluster def test_list_keys(client): result = client.graph().list_keys() @@ -387,7 +370,6 @@ def test_list_keys(client): assert result == [] -@pytest.mark.redismod def test_multi_label(client): redis_graph = client.graph("g") @@ -413,7 +395,6 @@ def test_multi_label(client): assert True -@pytest.mark.redismod def test_cache_sync(client): pass return @@ -486,7 +467,6 @@ def test_cache_sync(client): assert A._relationship_types[1] == "R" -@pytest.mark.redismod def test_execution_plan(client): redis_graph = client.graph("execution_plan") create_query = """CREATE @@ -505,7 +485,6 @@ def test_execution_plan(client): redis_graph.delete() -@pytest.mark.redismod def test_explain(client): redis_graph = client.graph("execution_plan") # graph creation / population @@ -594,7 +573,6 @@ def test_explain(client): redis_graph.delete() -@pytest.mark.redismod def test_resultset_statistics(client): with patch.object(target=QueryResult, attribute="_get_stat") as mock_get_stats: result = client.graph().query("RETURN 1") diff --git a/tests/test_json.py b/tests/test_json.py index fb608ff425..c0f2295a17 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -14,7 +14,6 @@ def client(request): return r -@pytest.mark.redismod def test_json_setbinarykey(client): d = {"hello": "world", b"some": "value"} with pytest.raises(TypeError): @@ -22,7 +21,6 @@ def test_json_setbinarykey(client): assert client.json().set("somekey", Path.root_path(), d, decode_keys=True) -@pytest.mark.redismod def test_json_setgetdeleteforget(client): assert client.json().set("foo", Path.root_path(), "bar") assert_resp_response(client, client.json().get("foo"), "bar", [["bar"]]) @@ -32,13 +30,11 @@ def test_json_setgetdeleteforget(client): assert client.exists("foo") == 0 -@pytest.mark.redismod def test_jsonget(client): client.json().set("foo", Path.root_path(), "bar") assert_resp_response(client, client.json().get("foo"), "bar", [["bar"]]) -@pytest.mark.redismod def test_json_get_jset(client): assert client.json().set("foo", Path.root_path(), "bar") assert_resp_response(client, client.json().get("foo"), "bar", [["bar"]]) @@ -47,7 +43,6 @@ def test_json_get_jset(client): assert client.exists("foo") == 0 -@pytest.mark.redismod @skip_ifmodversion_lt("2.6.0", "ReJSON") # todo: update after the release def test_json_merge(client): # Test with root path $ @@ -80,7 +75,6 @@ def test_json_merge(client): } -@pytest.mark.redismod def test_nonascii_setgetdelete(client): assert client.json().set("notascii", Path.root_path(), "hyvää-élève") res = "hyvää-élève" @@ -91,7 +85,6 @@ def test_nonascii_setgetdelete(client): assert client.exists("notascii") == 0 -@pytest.mark.redismod def test_jsonsetexistentialmodifiersshouldsucceed(client): obj = {"foo": "bar"} assert client.json().set("obj", Path.root_path(), obj) @@ -109,7 +102,6 @@ def test_jsonsetexistentialmodifiersshouldsucceed(client): client.json().set("obj", Path("foo"), "baz", nx=True, xx=True) -@pytest.mark.redismod def test_mgetshouldsucceed(client): client.json().set("1", Path.root_path(), 1) client.json().set("2", Path.root_path(), 2) @@ -118,7 +110,6 @@ def test_mgetshouldsucceed(client): assert client.json().mget([1, 2], Path.root_path()) == [1, 2] -@pytest.mark.redismod @skip_ifmodversion_lt("2.6.0", "ReJSON") # todo: update after the release def test_mset(client): client.json().mset([("1", Path.root_path(), 1), ("2", Path.root_path(), 2)]) @@ -127,7 +118,6 @@ def test_mset(client): assert client.json().mget(["1", "2"], Path.root_path()) == [1, 2] -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "ReJSON") # todo: update after the release def test_clear(client): client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) @@ -135,7 +125,6 @@ def test_clear(client): assert_resp_response(client, client.json().get("arr"), [], [[[]]]) -@pytest.mark.redismod def test_type(client): client.json().set("1", Path.root_path(), 1) assert_resp_response( @@ -144,7 +133,6 @@ def test_type(client): assert_resp_response(client, client.json().type("1"), "integer", ["integer"]) -@pytest.mark.redismod def test_numincrby(client): client.json().set("num", Path.root_path(), 1) assert_resp_response( @@ -158,7 +146,6 @@ def test_numincrby(client): ) -@pytest.mark.redismod def test_nummultby(client): client.json().set("num", Path.root_path(), 1) @@ -174,7 +161,6 @@ def test_nummultby(client): ) -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "ReJSON") # todo: update after the release def test_toggle(client): client.json().set("bool", Path.root_path(), False) @@ -186,7 +172,6 @@ def test_toggle(client): client.json().toggle("num", Path.root_path()) -@pytest.mark.redismod def test_strappend(client): client.json().set("jsonkey", Path.root_path(), "foo") assert 6 == client.json().strappend("jsonkey", "bar") @@ -195,8 +180,7 @@ def test_strappend(client): ) -# @pytest.mark.redismod -# def test_debug(client): +# # def test_debug(client): # client.json().set("str", Path.root_path(), "foo") # assert 24 == client.json().debug("MEMORY", "str", Path.root_path()) # assert 24 == client.json().debug("MEMORY", "str") @@ -205,7 +189,6 @@ def test_strappend(client): # assert isinstance(client.json().debug("HELP"), list) -@pytest.mark.redismod def test_strlen(client): client.json().set("str", Path.root_path(), "foo") assert 3 == client.json().strlen("str", Path.root_path()) @@ -214,7 +197,6 @@ def test_strlen(client): assert 6 == client.json().strlen("str") -@pytest.mark.redismod def test_arrappend(client): client.json().set("arr", Path.root_path(), [1]) assert 2 == client.json().arrappend("arr", Path.root_path(), 2) @@ -222,7 +204,6 @@ def test_arrappend(client): assert 7 == client.json().arrappend("arr", Path.root_path(), *[5, 6, 7]) -@pytest.mark.redismod def test_arrindex(client): client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 1 == client.json().arrindex("arr", Path.root_path(), 1) @@ -234,7 +215,6 @@ def test_arrindex(client): assert -1 == client.json().arrindex("arr", Path.root_path(), 4, start=1, stop=3) -@pytest.mark.redismod def test_arrinsert(client): client.json().set("arr", Path.root_path(), [0, 4]) assert 5 - -client.json().arrinsert("arr", Path.root_path(), 1, *[1, 2, 3]) @@ -248,7 +228,6 @@ def test_arrinsert(client): assert_resp_response(client, client.json().get("val2"), res, [[res]]) -@pytest.mark.redismod def test_arrlen(client): client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 5 == client.json().arrlen("arr", Path.root_path()) @@ -256,7 +235,6 @@ def test_arrlen(client): assert client.json().arrlen("fakekey") is None -@pytest.mark.redismod def test_arrpop(client): client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 4 == client.json().arrpop("arr", Path.root_path(), 4) @@ -274,7 +252,6 @@ def test_arrpop(client): assert client.json().arrpop("arr") is None -@pytest.mark.redismod def test_arrtrim(client): client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 3 == client.json().arrtrim("arr", Path.root_path(), 1, 3) @@ -297,7 +274,6 @@ def test_arrtrim(client): assert 0 == client.json().arrtrim("arr", Path.root_path(), 9, 11) -@pytest.mark.redismod def test_resp(client): obj = {"foo": "bar", "baz": 1, "qaz": True} client.json().set("obj", Path.root_path(), obj) @@ -307,7 +283,6 @@ def test_resp(client): assert isinstance(client.json().resp("obj"), list) -@pytest.mark.redismod def test_objkeys(client): obj = {"foo": "bar", "baz": "qaz"} client.json().set("obj", Path.root_path(), obj) @@ -324,7 +299,6 @@ def test_objkeys(client): assert client.json().objkeys("fakekey") is None -@pytest.mark.redismod def test_objlen(client): obj = {"foo": "bar", "baz": "qaz"} client.json().set("obj", Path.root_path(), obj) @@ -334,7 +308,6 @@ def test_objlen(client): assert len(obj) == client.json().objlen("obj") -@pytest.mark.redismod def test_json_commands_in_pipeline(client): p = client.json().pipeline() p.set("foo", Path.root_path(), "bar") @@ -358,7 +331,6 @@ def test_json_commands_in_pipeline(client): assert client.get("foo") is None -@pytest.mark.redismod def test_json_delete_with_dollar(client): doc1 = {"a": 1, "nested": {"a": 2, "b": 3}} assert client.json().set("doc1", "$", doc1) @@ -410,7 +382,6 @@ def test_json_delete_with_dollar(client): client.json().delete("not_a_document", "..a") -@pytest.mark.redismod def test_json_forget_with_dollar(client): doc1 = {"a": 1, "nested": {"a": 2, "b": 3}} assert client.json().set("doc1", "$", doc1) @@ -462,7 +433,6 @@ def test_json_forget_with_dollar(client): client.json().forget("not_a_document", "..a") -@pytest.mark.redismod def test_json_mget_dollar(client): # Test mget with multi paths client.json().set( @@ -492,7 +462,6 @@ def test_json_mget_dollar(client): assert res == [None, None] -@pytest.mark.redismod def test_numby_commands_dollar(client): # Test NUMINCRBY @@ -537,7 +506,6 @@ def test_numby_commands_dollar(client): client.json().nummultby("doc1", ".b[0].a", 3) == 6 -@pytest.mark.redismod def test_strappend_dollar(client): client.json().set( @@ -569,7 +537,6 @@ def test_strappend_dollar(client): client.json().strappend("doc1", "piu") -@pytest.mark.redismod def test_strlen_dollar(client): # Test multi @@ -591,7 +558,6 @@ def test_strlen_dollar(client): client.json().strlen("non_existing_doc", "$..a") -@pytest.mark.redismod def test_arrappend_dollar(client): client.json().set( "doc1", @@ -666,7 +632,6 @@ def test_arrappend_dollar(client): client.json().arrappend("non_existing_doc", "$..a") -@pytest.mark.redismod def test_arrinsert_dollar(client): client.json().set( "doc1", @@ -705,7 +670,6 @@ def test_arrinsert_dollar(client): client.json().arrappend("non_existing_doc", "$..a") -@pytest.mark.redismod def test_arrlen_dollar(client): client.json().set( @@ -755,7 +719,6 @@ def test_arrlen_dollar(client): assert client.json().arrlen("non_existing_doc", "..a") is None -@pytest.mark.redismod def test_arrpop_dollar(client): client.json().set( "doc1", @@ -797,7 +760,6 @@ def test_arrpop_dollar(client): client.json().arrpop("non_existing_doc", "..a") -@pytest.mark.redismod def test_arrtrim_dollar(client): client.json().set( @@ -851,7 +813,6 @@ def test_arrtrim_dollar(client): client.json().arrtrim("non_existing_doc", "..a", 1, 1) -@pytest.mark.redismod def test_objkeys_dollar(client): client.json().set( "doc1", @@ -881,7 +842,6 @@ def test_objkeys_dollar(client): assert client.json().objkeys("doc1", "$..nowhere") == [] -@pytest.mark.redismod def test_objlen_dollar(client): client.json().set( "doc1", @@ -917,7 +877,6 @@ def test_objlen_dollar(client): client.json().objlen("doc1", ".nowhere") -@pytest.mark.redismod def load_types_data(nested_key_name): td = { "object": {}, @@ -937,7 +896,6 @@ def load_types_data(nested_key_name): return jdata, types -@pytest.mark.redismod def test_type_dollar(client): jdata, jtypes = load_types_data("a") client.json().set("doc1", "$", jdata) @@ -955,7 +913,6 @@ def test_type_dollar(client): ) -@pytest.mark.redismod def test_clear_dollar(client): client.json().set( "doc1", @@ -1006,7 +963,6 @@ def test_clear_dollar(client): client.json().clear("non_existing_doc", "$..a") -@pytest.mark.redismod def test_toggle_dollar(client): client.json().set( "doc1", @@ -1035,8 +991,7 @@ def test_toggle_dollar(client): client.json().toggle("non_existing_doc", "$..a") -# @pytest.mark.redismod -# def test_debug_dollar(client): +# # def test_debug_dollar(client): # # jdata, jtypes = load_types_data("a") # @@ -1058,7 +1013,6 @@ def test_toggle_dollar(client): # assert client.json().debug("MEMORY", "non_existing_doc", "$..a") == [] -@pytest.mark.redismod def test_resp_dollar(client): data = { @@ -1288,7 +1242,6 @@ def test_resp_dollar(client): client.json().resp("non_existing_doc", "$..a") -@pytest.mark.redismod def test_arrindex_dollar(client): client.json().set( @@ -1515,7 +1468,6 @@ def test_arrindex_dollar(client): assert client.json().arrindex("test_None", "..nested2_not_found.arr", "None") == 0 -@pytest.mark.redismod def test_decoders_and_unstring(): assert unstring("4") == 4 assert unstring("45.55") == 45.55 @@ -1526,7 +1478,6 @@ def test_decoders_and_unstring(): assert decode_list(["hello", b"world"]) == ["hello", "world"] -@pytest.mark.redismod def test_custom_decoder(client): import json @@ -1542,7 +1493,6 @@ def test_custom_decoder(client): assert not isinstance(cj.__decoder__, json.JSONDecoder) -@pytest.mark.redismod def test_set_file(client): import json import tempfile @@ -1561,7 +1511,6 @@ def test_set_file(client): client.json().set_file("test2", Path.root_path(), nojsonfile.name) -@pytest.mark.redismod def test_set_path(client): import json import tempfile diff --git a/tests/test_timeseries.py b/tests/test_timeseries.py index 80490af4ef..c8e4bb5393 100644 --- a/tests/test_timeseries.py +++ b/tests/test_timeseries.py @@ -14,7 +14,6 @@ def client(decoded_r): return decoded_r -@pytest.mark.redismod def test_create(client): assert client.ts().create(1) assert client.ts().create(2, retention_msecs=5) @@ -32,7 +31,6 @@ def test_create(client): assert_resp_response(client, 128, info.get("chunk_size"), info.get("chunkSize")) -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") def test_create_duplicate_policy(client): # Test for duplicate policy @@ -48,7 +46,6 @@ def test_create_duplicate_policy(client): ) -@pytest.mark.redismod def test_alter(client): assert client.ts().create(1) info = client.ts().info(1) @@ -69,7 +66,6 @@ def test_alter(client): ) -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") def test_alter_diplicate_policy(client): assert client.ts().create(1) @@ -84,7 +80,6 @@ def test_alter_diplicate_policy(client): ) -@pytest.mark.redismod def test_add(client): assert 1 == client.ts().add(1, 1, 1) assert 2 == client.ts().add(2, 2, 3, retention_msecs=10) @@ -107,7 +102,6 @@ def test_add(client): assert_resp_response(client, 128, info.get("chunk_size"), info.get("chunkSize")) -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") def test_add_duplicate_policy(client): @@ -145,13 +139,11 @@ def test_add_duplicate_policy(client): assert 5.0 == client.ts().get("time-serie-add-ooo-min")[1] -@pytest.mark.redismod def test_madd(client): client.ts().create("a") assert [1, 2, 3] == client.ts().madd([("a", 1, 5), ("a", 2, 10), ("a", 3, 15)]) -@pytest.mark.redismod def test_incrby_decrby(client): for _ in range(100): assert client.ts().incrby(1, 1) @@ -180,7 +172,6 @@ def test_incrby_decrby(client): assert_resp_response(client, 128, info.get("chunk_size"), info.get("chunkSize")) -@pytest.mark.redismod def test_create_and_delete_rule(client): # test rule creation time = 100 @@ -204,7 +195,6 @@ def test_create_and_delete_rule(client): assert not info["rules"] -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") def test_del_range(client): try: @@ -219,7 +209,6 @@ def test_del_range(client): assert_resp_response(client, client.ts().range(1, 22, 22), [(22, 1.0)], [[22, 1.0]]) -@pytest.mark.redismod def test_range(client): for i in range(100): client.ts().add(1, i, i % 7) @@ -234,7 +223,6 @@ def test_range(client): assert 10 == len(client.ts().range(1, 0, 500, count=10)) -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") def test_range_advanced(client): for i in range(100): @@ -263,7 +251,6 @@ def test_range_advanced(client): assert_resp_response(client, res, [(0, 2.55), (10, 3.0)], [[0, 2.55], [10, 3.0]]) -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_range_latest(client: redis.Redis): timeseries = client.ts() @@ -288,7 +275,6 @@ def test_range_latest(client: redis.Redis): ) -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_range_bucket_timestamp(client: redis.Redis): timeseries = client.ts() @@ -322,7 +308,6 @@ def test_range_bucket_timestamp(client: redis.Redis): ) -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_range_empty(client: redis.Redis): timeseries = client.ts() @@ -367,7 +352,6 @@ def test_range_empty(client: redis.Redis): assert_resp_response(client, res, resp2_expected, resp3_expected) -@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") def test_rev_range(client): for i in range(100): @@ -415,7 +399,6 @@ def test_rev_range(client): ) -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_revrange_latest(client: redis.Redis): timeseries = client.ts() @@ -434,7 +417,6 @@ def test_revrange_latest(client: redis.Redis): assert_resp_response(client, res, [(0, 4.0)], [[0, 4.0]]) -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_revrange_bucket_timestamp(client: redis.Redis): timeseries = client.ts() @@ -468,7 +450,6 @@ def test_revrange_bucket_timestamp(client: redis.Redis): ) -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_revrange_empty(client: redis.Redis): timeseries = client.ts() @@ -513,7 +494,6 @@ def test_revrange_empty(client: redis.Redis): assert_resp_response(client, res, resp2_expected, resp3_expected) -@pytest.mark.redismod @pytest.mark.onlynoncluster def test_mrange(client): client.ts().create(1, labels={"Test": "This", "team": "ny"}) @@ -562,7 +542,6 @@ def test_mrange(client): assert {"Test": "This", "team": "ny"} == res["1"][0] -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("99.99.99", "timeseries") def test_multi_range_advanced(client): @@ -676,7 +655,6 @@ def test_multi_range_advanced(client): assert [[0, 5.0], [5, 6.0]] == res["1"][2] -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("1.8.0", "timeseries") def test_mrange_latest(client: redis.Redis): @@ -706,7 +684,6 @@ def test_mrange_latest(client: redis.Redis): ) -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("99.99.99", "timeseries") def test_multi_reverse_range(client): @@ -825,7 +802,6 @@ def test_multi_reverse_range(client): assert [[1, 10.0], [0, 1.0]] == res["1"][2] -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("1.8.0", "timeseries") def test_mrevrange_latest(client: redis.Redis): @@ -855,7 +831,6 @@ def test_mrevrange_latest(client: redis.Redis): ) -@pytest.mark.redismod def test_get(client): name = "test" client.ts().create(name) @@ -866,7 +841,6 @@ def test_get(client): assert 4 == client.ts().get(name)[1] -@pytest.mark.redismod @skip_ifmodversion_lt("1.8.0", "timeseries") def test_get_latest(client: redis.Redis): timeseries = client.ts() @@ -883,7 +857,6 @@ def test_get_latest(client: redis.Redis): ) -@pytest.mark.redismod @pytest.mark.onlynoncluster def test_mget(client): client.ts().create(1, labels={"Test": "This"}) @@ -919,7 +892,6 @@ def test_mget(client): assert {"Taste": "That", "Test": "This"} == res["2"][0] -@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("1.8.0", "timeseries") def test_mget_latest(client: redis.Redis): @@ -937,7 +909,6 @@ def test_mget_latest(client: redis.Redis): assert_resp_response(client, res, [{"t2": [{}, 10, 8.0]}], {"t2": [{}, [10, 8.0]]}) -@pytest.mark.redismod def test_info(client): client.ts().create(1, retention_msecs=5, labels={"currentLabel": "currentData"}) info = client.ts().info(1) @@ -947,7 +918,6 @@ def test_info(client): assert info["labels"]["currentLabel"] == "currentData" -@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") def testInfoDuplicatePolicy(client): client.ts().create(1, retention_msecs=5, labels={"currentLabel": "currentData"}) @@ -963,7 +933,6 @@ def testInfoDuplicatePolicy(client): ) -@pytest.mark.redismod @pytest.mark.onlynoncluster def test_query_index(client): client.ts().create(1, labels={"Test": "This"}) @@ -973,7 +942,6 @@ def test_query_index(client): assert_resp_response(client, client.ts().queryindex(["Taste=That"]), [2], {"2"}) -@pytest.mark.redismod def test_pipeline(client): pipeline = client.ts().pipeline() pipeline.create("with_pipeline") @@ -991,7 +959,6 @@ def test_pipeline(client): assert client.ts().get("with_pipeline")[1] == 99 * 1.1 -@pytest.mark.redismod def test_uncompressed(client): client.ts().create("compressed") client.ts().create("uncompressed", uncompressed=True) From 5868fecec48c68c97b70dda00a0554810073a857 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 00:23:18 +0300 Subject: [PATCH 02/12] remove async tests --- tests/test_asyncio/test_bloom.py | 26 +++++++++++++++- tests/test_asyncio/test_graph.py | 20 ++++++++++++ tests/test_asyncio/test_json.py | 45 ++++++++++++++++++++++++++- tests/test_asyncio/test_timeseries.py | 25 ++++++++++++++- 4 files changed, 113 insertions(+), 3 deletions(-) diff --git a/tests/test_asyncio/test_bloom.py b/tests/test_asyncio/test_bloom.py index b2f0b4337a..0535ddfe02 100644 --- a/tests/test_asyncio/test_bloom.py +++ b/tests/test_asyncio/test_bloom.py @@ -15,6 +15,7 @@ def intlist(obj): return [int(v) for v in obj] +@pytest.mark.redismod async def test_create(decoded_r: redis.Redis): """Test CREATE/RESERVE calls""" assert await decoded_r.bf().create("bloom", 0.01, 1000) @@ -29,11 +30,13 @@ async def test_create(decoded_r: redis.Redis): assert await decoded_r.topk().reserve("topk", 5, 100, 5, 0.9) +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_create(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 100) +@pytest.mark.redismod async def test_bf_add(decoded_r: redis.Redis): assert await decoded_r.bf().create("bloom", 0.01, 1000) assert 1 == await decoded_r.bf().add("bloom", "foo") @@ -46,6 +49,7 @@ async def test_bf_add(decoded_r: redis.Redis): assert [1, 0] == intlist(await decoded_r.bf().mexists("bloom", "foo", "noexist")) +@pytest.mark.redismod async def test_bf_insert(decoded_r: redis.Redis): assert await decoded_r.bf().create("bloom", 0.01, 1000) assert [1] == intlist(await decoded_r.bf().insert("bloom", ["foo"])) @@ -76,6 +80,7 @@ async def test_bf_insert(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_bf_scandump_and_loadchunk(decoded_r: redis.Redis): # Store a filter await decoded_r.bf().create("myBloom", "0.0001", "1000") @@ -127,6 +132,7 @@ async def do_verify(): await decoded_r.bf().create("myBloom", "0.0001", "10000000") +@pytest.mark.redismod async def test_bf_info(decoded_r: redis.Redis): expansion = 4 # Store a filter @@ -158,6 +164,7 @@ async def test_bf_info(decoded_r: redis.Redis): assert True +@pytest.mark.redismod async def test_bf_card(decoded_r: redis.Redis): # return 0 if the key does not exist assert await decoded_r.bf().card("not_exist") == 0 @@ -172,6 +179,7 @@ async def test_bf_card(decoded_r: redis.Redis): await decoded_r.bf().card("setKey") +@pytest.mark.redismod async def test_cf_add_and_insert(decoded_r: redis.Redis): assert await decoded_r.cf().create("cuckoo", 1000) assert await decoded_r.cf().add("cuckoo", "filter") @@ -197,6 +205,7 @@ async def test_cf_add_and_insert(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_cf_exists_and_del(decoded_r: redis.Redis): assert await decoded_r.cf().create("cuckoo", 1000) assert await decoded_r.cf().add("cuckoo", "filter") @@ -208,6 +217,7 @@ async def test_cf_exists_and_del(decoded_r: redis.Redis): assert 0 == await decoded_r.cf().count("cuckoo", "filter") +@pytest.mark.redismod async def test_cms(decoded_r: redis.Redis): assert await decoded_r.cms().initbydim("dim", 1000, 5) assert await decoded_r.cms().initbyprob("prob", 0.01, 0.01) @@ -223,6 +233,7 @@ async def test_cms(decoded_r: redis.Redis): assert 25 == info["count"] +@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_cms_merge(decoded_r: redis.Redis): assert await decoded_r.cms().initbydim("A", 1000, 5) @@ -240,6 +251,7 @@ async def test_cms_merge(decoded_r: redis.Redis): assert [16, 15, 21] == await decoded_r.cms().query("C", "foo", "bar", "baz") +@pytest.mark.redismod async def test_topk(decoded_r: redis.Redis): # test list with empty buckets assert await decoded_r.topk().reserve("topk", 3, 50, 4, 0.9) @@ -320,6 +332,7 @@ async def test_topk(decoded_r: redis.Redis): assert 0.9 == round(float(info["decay"]), 1) +@pytest.mark.redismod async def test_topk_incrby(decoded_r: redis.Redis): await decoded_r.flushdb() assert await decoded_r.topk().reserve("topk", 3, 10, 3, 1) @@ -334,6 +347,7 @@ async def test_topk_incrby(decoded_r: redis.Redis): ) +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_reset(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 10) @@ -350,6 +364,7 @@ async def test_tdigest_reset(decoded_r: redis.Redis): ) +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_merge(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("to-tDigest", 10) @@ -377,6 +392,7 @@ async def test_tdigest_merge(decoded_r: redis.Redis): assert 4.0 == await decoded_r.tdigest().max("to-tDigest") +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_min_and_max(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 100) @@ -387,6 +403,7 @@ async def test_tdigest_min_and_max(decoded_r: redis.Redis): assert 1 == await decoded_r.tdigest().min("tDigest") +@pytest.mark.redismod @pytest.mark.experimental @skip_ifmodversion_lt("2.4.0", "bf") async def test_tdigest_quantile(decoded_r: redis.Redis): @@ -415,6 +432,7 @@ async def test_tdigest_quantile(decoded_r: redis.Redis): assert [3.0, 5.0] == res +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_cdf(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("tDigest", 100) @@ -426,6 +444,7 @@ async def test_tdigest_cdf(decoded_r: redis.Redis): assert [0.1, 0.9] == [round(x, 1) for x in res] +@pytest.mark.redismod @pytest.mark.experimental @skip_ifmodversion_lt("2.4.0", "bf") async def test_tdigest_trimmed_mean(decoded_r: redis.Redis): @@ -436,6 +455,7 @@ async def test_tdigest_trimmed_mean(decoded_r: redis.Redis): assert 4.5 == await decoded_r.tdigest().trimmed_mean("tDigest", 0.4, 0.5) +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_rank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -446,6 +466,7 @@ async def test_tdigest_rank(decoded_r: redis.Redis): assert [-1, 20, 9] == await decoded_r.tdigest().rank("t-digest", -20, 20, 9) +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_revrank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -455,6 +476,7 @@ async def test_tdigest_revrank(decoded_r: redis.Redis): assert [-1, 19, 9] == await decoded_r.tdigest().revrank("t-digest", 21, 0, 10) +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_byrank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -466,6 +488,7 @@ async def test_tdigest_byrank(decoded_r: redis.Redis): (await decoded_r.tdigest().byrank("t-digest", -1))[0] +@pytest.mark.redismod @pytest.mark.experimental async def test_tdigest_byrevrank(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("t-digest", 500) @@ -477,7 +500,8 @@ async def test_tdigest_byrevrank(decoded_r: redis.Redis): (await decoded_r.tdigest().byrevrank("t-digest", -1))[0] -# # async def test_pipeline(decoded_r: redis.Redis): +# @pytest.mark.redismod +# async def test_pipeline(decoded_r: redis.Redis): # pipeline = await decoded_r.bf().pipeline() # assert not await decoded_r.bf().execute_command("get pipeline") # diff --git a/tests/test_asyncio/test_graph.py b/tests/test_asyncio/test_graph.py index 4caf79470e..22195901e6 100644 --- a/tests/test_asyncio/test_graph.py +++ b/tests/test_asyncio/test_graph.py @@ -6,12 +6,14 @@ from tests.conftest import skip_if_redis_enterprise +@pytest.mark.redismod async def test_bulk(decoded_r): with pytest.raises(NotImplementedError): await decoded_r.graph().bulk() await decoded_r.graph().bulk(foo="bar!") +@pytest.mark.redismod async def test_graph_creation(decoded_r: redis.Redis): graph = decoded_r.graph() @@ -56,6 +58,7 @@ async def test_graph_creation(decoded_r: redis.Redis): await graph.delete() +@pytest.mark.redismod async def test_array_functions(decoded_r: redis.Redis): graph = decoded_r.graph() @@ -78,6 +81,7 @@ async def test_array_functions(decoded_r: redis.Redis): assert [a] == result.result_set[0][0] +@pytest.mark.redismod async def test_path(decoded_r: redis.Redis): node0 = Node(node_id=0, label="L1") node1 = Node(node_id=1, label="L1") @@ -97,6 +101,7 @@ async def test_path(decoded_r: redis.Redis): assert expected_results == result.result_set +@pytest.mark.redismod async def test_param(decoded_r: redis.Redis): params = [1, 2.3, "str", True, False, None, [0, 1, 2]] query = "RETURN $param" @@ -106,6 +111,7 @@ async def test_param(decoded_r: redis.Redis): assert expected_results == result.result_set +@pytest.mark.redismod async def test_map(decoded_r: redis.Redis): query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}" @@ -122,6 +128,7 @@ async def test_map(decoded_r: redis.Redis): assert actual == expected +@pytest.mark.redismod async def test_point(decoded_r: redis.Redis): query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})" expected_lat = 32.070794860 @@ -138,6 +145,7 @@ async def test_point(decoded_r: redis.Redis): assert abs(actual["longitude"] - expected_lon) < 0.001 +@pytest.mark.redismod async def test_index_response(decoded_r: redis.Redis): result_set = await decoded_r.graph().query("CREATE INDEX ON :person(age)") assert 1 == result_set.indices_created @@ -152,6 +160,7 @@ async def test_index_response(decoded_r: redis.Redis): await decoded_r.graph().query("DROP INDEX ON :person(age)") +@pytest.mark.redismod async def test_stringify_query_result(decoded_r: redis.Redis): graph = decoded_r.graph() @@ -205,6 +214,7 @@ async def test_stringify_query_result(decoded_r: redis.Redis): await graph.delete() +@pytest.mark.redismod async def test_optional_match(decoded_r: redis.Redis): # Build a graph of form (a)-[R]->(b) node0 = Node(node_id=0, label="L1", properties={"value": "a"}) @@ -229,6 +239,7 @@ async def test_optional_match(decoded_r: redis.Redis): await graph.delete() +@pytest.mark.redismod async def test_cached_execution(decoded_r: redis.Redis): await decoded_r.graph().query("CREATE ()") @@ -248,6 +259,7 @@ async def test_cached_execution(decoded_r: redis.Redis): assert cached_result.cached_execution +@pytest.mark.redismod async def test_slowlog(decoded_r: redis.Redis): create_query = """CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}), @@ -260,6 +272,7 @@ async def test_slowlog(decoded_r: redis.Redis): assert results[0][2] == create_query +@pytest.mark.redismod @pytest.mark.xfail(strict=False) async def test_query_timeout(decoded_r: redis.Redis): # Build a sample graph with 1000 nodes. @@ -274,6 +287,7 @@ async def test_query_timeout(decoded_r: redis.Redis): assert False is False +@pytest.mark.redismod async def test_read_only_query(decoded_r: redis.Redis): with pytest.raises(Exception): # Issue a write query, specifying read-only true, @@ -282,6 +296,7 @@ async def test_read_only_query(decoded_r: redis.Redis): assert False is False +@pytest.mark.redismod async def test_profile(decoded_r: redis.Redis): q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})""" profile = (await decoded_r.graph().profile(q)).result_set @@ -296,6 +311,7 @@ async def test_profile(decoded_r: redis.Redis): assert "Node By Label Scan | (p:Person) | Records produced: 3" in profile +@pytest.mark.redismod @skip_if_redis_enterprise() async def test_config(decoded_r: redis.Redis): config_name = "RESULTSET_SIZE" @@ -327,6 +343,7 @@ async def test_config(decoded_r: redis.Redis): await decoded_r.graph().config("RESULTSET_SIZE", -100, set=True) +@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_list_keys(decoded_r: redis.Redis): result = await decoded_r.graph().list_keys() @@ -350,6 +367,7 @@ async def test_list_keys(decoded_r: redis.Redis): assert result == [] +@pytest.mark.redismod async def test_multi_label(decoded_r: redis.Redis): redis_graph = decoded_r.graph("g") @@ -375,6 +393,7 @@ async def test_multi_label(decoded_r: redis.Redis): assert True +@pytest.mark.redismod async def test_execution_plan(decoded_r: redis.Redis): redis_graph = decoded_r.graph("execution_plan") create_query = """CREATE @@ -393,6 +412,7 @@ async def test_execution_plan(decoded_r: redis.Redis): await redis_graph.delete() +@pytest.mark.redismod async def test_explain(decoded_r: redis.Redis): redis_graph = decoded_r.graph("execution_plan") # graph creation / population diff --git a/tests/test_asyncio/test_json.py b/tests/test_asyncio/test_json.py index a9cba47734..6f3e8c3251 100644 --- a/tests/test_asyncio/test_json.py +++ b/tests/test_asyncio/test_json.py @@ -5,6 +5,7 @@ from tests.conftest import assert_resp_response, skip_ifmodversion_lt +@pytest.mark.redismod async def test_json_setbinarykey(decoded_r: redis.Redis): d = {"hello": "world", b"some": "value"} with pytest.raises(TypeError): @@ -12,6 +13,7 @@ async def test_json_setbinarykey(decoded_r: redis.Redis): assert await decoded_r.json().set("somekey", Path.root_path(), d, decode_keys=True) +@pytest.mark.redismod async def test_json_setgetdeleteforget(decoded_r: redis.Redis): assert await decoded_r.json().set("foo", Path.root_path(), "bar") assert_resp_response(decoded_r, await decoded_r.json().get("foo"), "bar", [["bar"]]) @@ -21,11 +23,13 @@ async def test_json_setgetdeleteforget(decoded_r: redis.Redis): assert await decoded_r.exists("foo") == 0 +@pytest.mark.redismod async def test_jsonget(decoded_r: redis.Redis): await decoded_r.json().set("foo", Path.root_path(), "bar") assert_resp_response(decoded_r, await decoded_r.json().get("foo"), "bar", [["bar"]]) +@pytest.mark.redismod async def test_json_get_jset(decoded_r: redis.Redis): assert await decoded_r.json().set("foo", Path.root_path(), "bar") assert_resp_response(decoded_r, await decoded_r.json().get("foo"), "bar", [["bar"]]) @@ -34,6 +38,7 @@ async def test_json_get_jset(decoded_r: redis.Redis): assert await decoded_r.exists("foo") == 0 +@pytest.mark.redismod async def test_nonascii_setgetdelete(decoded_r: redis.Redis): assert await decoded_r.json().set("notascii", Path.root_path(), "hyvää-élève") res = "hyvää-élève" @@ -44,6 +49,7 @@ async def test_nonascii_setgetdelete(decoded_r: redis.Redis): assert await decoded_r.exists("notascii") == 0 +@pytest.mark.redismod @skip_ifmodversion_lt("2.6.0", "ReJSON") async def test_json_merge(decoded_r: redis.Redis): # Test with root path $ @@ -78,6 +84,7 @@ async def test_json_merge(decoded_r: redis.Redis): } +@pytest.mark.redismod async def test_jsonsetexistentialmodifiersshouldsucceed(decoded_r: redis.Redis): obj = {"foo": "bar"} assert await decoded_r.json().set("obj", Path.root_path(), obj) @@ -95,6 +102,7 @@ async def test_jsonsetexistentialmodifiersshouldsucceed(decoded_r: redis.Redis): await decoded_r.json().set("obj", Path("foo"), "baz", nx=True, xx=True) +@pytest.mark.redismod async def test_mgetshouldsucceed(decoded_r: redis.Redis): await decoded_r.json().set("1", Path.root_path(), 1) await decoded_r.json().set("2", Path.root_path(), 2) @@ -103,6 +111,7 @@ async def test_mgetshouldsucceed(decoded_r: redis.Redis): assert await decoded_r.json().mget([1, 2], Path.root_path()) == [1, 2] +@pytest.mark.redismod @skip_ifmodversion_lt("2.6.0", "ReJSON") async def test_mset(decoded_r: redis.Redis): await decoded_r.json().mset( @@ -113,6 +122,7 @@ async def test_mset(decoded_r: redis.Redis): assert await decoded_r.json().mget(["1", "2"], Path.root_path()) == [1, 2] +@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "ReJSON") # todo: update after the release async def test_clear(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) @@ -120,6 +130,7 @@ async def test_clear(decoded_r: redis.Redis): assert_resp_response(decoded_r, await decoded_r.json().get("arr"), [], [[[]]]) +@pytest.mark.redismod async def test_type(decoded_r: redis.Redis): await decoded_r.json().set("1", Path.root_path(), 1) assert_resp_response( @@ -133,6 +144,7 @@ async def test_type(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_numincrby(decoded_r): await decoded_r.json().set("num", Path.root_path(), 1) assert_resp_response( @@ -144,6 +156,7 @@ async def test_numincrby(decoded_r): assert_resp_response(decoded_r, res, 1.25, [1.25]) +@pytest.mark.redismod async def test_nummultby(decoded_r: redis.Redis): await decoded_r.json().set("num", Path.root_path(), 1) @@ -156,6 +169,7 @@ async def test_nummultby(decoded_r: redis.Redis): assert_resp_response(decoded_r, res, 2.5, [2.5]) +@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "ReJSON") # todo: update after the release async def test_toggle(decoded_r: redis.Redis): await decoded_r.json().set("bool", Path.root_path(), False) @@ -167,6 +181,7 @@ async def test_toggle(decoded_r: redis.Redis): await decoded_r.json().toggle("num", Path.root_path()) +@pytest.mark.redismod async def test_strappend(decoded_r: redis.Redis): await decoded_r.json().set("jsonkey", Path.root_path(), "foo") assert 6 == await decoded_r.json().strappend("jsonkey", "bar") @@ -174,6 +189,7 @@ async def test_strappend(decoded_r: redis.Redis): assert_resp_response(decoded_r, res, "foobar", [["foobar"]]) +@pytest.mark.redismod async def test_strlen(decoded_r: redis.Redis): await decoded_r.json().set("str", Path.root_path(), "foo") assert 3 == await decoded_r.json().strlen("str", Path.root_path()) @@ -182,6 +198,7 @@ async def test_strlen(decoded_r: redis.Redis): assert 6 == await decoded_r.json().strlen("str") +@pytest.mark.redismod async def test_arrappend(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [1]) assert 2 == await decoded_r.json().arrappend("arr", Path.root_path(), 2) @@ -189,6 +206,7 @@ async def test_arrappend(decoded_r: redis.Redis): assert 7 == await decoded_r.json().arrappend("arr", Path.root_path(), *[5, 6, 7]) +@pytest.mark.redismod async def test_arrindex(decoded_r: redis.Redis): r_path = Path.root_path() await decoded_r.json().set("arr", r_path, [0, 1, 2, 3, 4]) @@ -201,6 +219,7 @@ async def test_arrindex(decoded_r: redis.Redis): assert -1 == await decoded_r.json().arrindex("arr", r_path, 4, start=1, stop=3) +@pytest.mark.redismod async def test_arrinsert(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 4]) assert 5 == await decoded_r.json().arrinsert("arr", Path.root_path(), 1, *[1, 2, 3]) @@ -214,6 +233,7 @@ async def test_arrinsert(decoded_r: redis.Redis): assert_resp_response(decoded_r, await decoded_r.json().get("val2"), res, [[res]]) +@pytest.mark.redismod async def test_arrlen(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 5 == await decoded_r.json().arrlen("arr", Path.root_path()) @@ -221,6 +241,7 @@ async def test_arrlen(decoded_r: redis.Redis): assert await decoded_r.json().arrlen("fakekey") is None +@pytest.mark.redismod async def test_arrpop(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 4 == await decoded_r.json().arrpop("arr", Path.root_path(), 4) @@ -238,6 +259,7 @@ async def test_arrpop(decoded_r: redis.Redis): assert await decoded_r.json().arrpop("arr") is None +@pytest.mark.redismod async def test_arrtrim(decoded_r: redis.Redis): await decoded_r.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4]) assert 3 == await decoded_r.json().arrtrim("arr", Path.root_path(), 1, 3) @@ -261,6 +283,7 @@ async def test_arrtrim(decoded_r: redis.Redis): assert 0 == await decoded_r.json().arrtrim("arr", Path.root_path(), 9, 11) +@pytest.mark.redismod async def test_resp(decoded_r: redis.Redis): obj = {"foo": "bar", "baz": 1, "qaz": True} await decoded_r.json().set("obj", Path.root_path(), obj) @@ -270,6 +293,7 @@ async def test_resp(decoded_r: redis.Redis): assert isinstance(await decoded_r.json().resp("obj"), list) +@pytest.mark.redismod async def test_objkeys(decoded_r: redis.Redis): obj = {"foo": "bar", "baz": "qaz"} await decoded_r.json().set("obj", Path.root_path(), obj) @@ -286,6 +310,7 @@ async def test_objkeys(decoded_r: redis.Redis): assert await decoded_r.json().objkeys("fakekey") is None +@pytest.mark.redismod async def test_objlen(decoded_r: redis.Redis): obj = {"foo": "bar", "baz": "qaz"} await decoded_r.json().set("obj", Path.root_path(), obj) @@ -295,7 +320,8 @@ async def test_objlen(decoded_r: redis.Redis): assert len(obj) == await decoded_r.json().objlen("obj") -# # async def test_json_commands_in_pipeline(decoded_r: redis.Redis): +# @pytest.mark.redismod +# async def test_json_commands_in_pipeline(decoded_r: redis.Redis): # async with decoded_r.json().pipeline() as p: # p.set("foo", Path.root_path(), "bar") # p.get("foo") @@ -318,6 +344,7 @@ async def test_objlen(decoded_r: redis.Redis): # assert await decoded_r.get("foo") is None +@pytest.mark.redismod async def test_json_delete_with_dollar(decoded_r: redis.Redis): doc1 = {"a": 1, "nested": {"a": 2, "b": 3}} assert await decoded_r.json().set("doc1", "$", doc1) @@ -371,6 +398,7 @@ async def test_json_delete_with_dollar(decoded_r: redis.Redis): await decoded_r.json().delete("not_a_document", "..a") +@pytest.mark.redismod async def test_json_forget_with_dollar(decoded_r: redis.Redis): doc1 = {"a": 1, "nested": {"a": 2, "b": 3}} assert await decoded_r.json().set("doc1", "$", doc1) @@ -423,6 +451,7 @@ async def test_json_forget_with_dollar(decoded_r: redis.Redis): await decoded_r.json().forget("not_a_document", "..a") +@pytest.mark.redismod async def test_json_mget_dollar(decoded_r: redis.Redis): # Test mget with multi paths await decoded_r.json().set( @@ -458,6 +487,7 @@ async def test_json_mget_dollar(decoded_r: redis.Redis): assert res == [None, None] +@pytest.mark.redismod async def test_numby_commands_dollar(decoded_r: redis.Redis): # Test NUMINCRBY @@ -513,6 +543,7 @@ async def test_numby_commands_dollar(decoded_r: redis.Redis): await decoded_r.json().nummultby("doc1", ".b[0].a", 3) == 6 +@pytest.mark.redismod async def test_strappend_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -544,6 +575,7 @@ async def test_strappend_dollar(decoded_r: redis.Redis): await decoded_r.json().strappend("doc1", "piu") +@pytest.mark.redismod async def test_strlen_dollar(decoded_r: redis.Redis): # Test multi @@ -565,6 +597,7 @@ async def test_strlen_dollar(decoded_r: redis.Redis): await decoded_r.json().strlen("non_existing_doc", "$..a") +@pytest.mark.redismod async def test_arrappend_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -638,6 +671,7 @@ async def test_arrappend_dollar(decoded_r: redis.Redis): await decoded_r.json().arrappend("non_existing_doc", "$..a") +@pytest.mark.redismod async def test_arrinsert_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -676,6 +710,7 @@ async def test_arrinsert_dollar(decoded_r: redis.Redis): await decoded_r.json().arrappend("non_existing_doc", "$..a") +@pytest.mark.redismod async def test_arrlen_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -722,6 +757,7 @@ async def test_arrlen_dollar(decoded_r: redis.Redis): assert await decoded_r.json().arrlen("non_existing_doc", "..a") is None +@pytest.mark.redismod async def test_arrpop_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -763,6 +799,7 @@ async def test_arrpop_dollar(decoded_r: redis.Redis): await decoded_r.json().arrpop("non_existing_doc", "..a") +@pytest.mark.redismod async def test_arrtrim_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -815,6 +852,7 @@ async def test_arrtrim_dollar(decoded_r: redis.Redis): await decoded_r.json().arrtrim("non_existing_doc", "..a", 1, 1) +@pytest.mark.redismod async def test_objkeys_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -844,6 +882,7 @@ async def test_objkeys_dollar(decoded_r: redis.Redis): assert await decoded_r.json().objkeys("doc1", "$..nowhere") == [] +@pytest.mark.redismod async def test_objlen_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", @@ -879,6 +918,7 @@ async def test_objlen_dollar(decoded_r: redis.Redis): await decoded_r.json().objlen("doc1", ".nowhere") +@pytest.mark.redismod def load_types_data(nested_key_name): td = { "object": {}, @@ -898,6 +938,7 @@ def load_types_data(nested_key_name): return jdata, types +@pytest.mark.redismod async def test_type_dollar(decoded_r: redis.Redis): jdata, jtypes = load_types_data("a") await decoded_r.json().set("doc1", "$", jdata) @@ -916,6 +957,7 @@ async def test_type_dollar(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_clear_dollar(decoded_r: redis.Redis): await decoded_r.json().set( @@ -970,6 +1012,7 @@ async def test_clear_dollar(decoded_r: redis.Redis): await decoded_r.json().clear("non_existing_doc", "$..a") +@pytest.mark.redismod async def test_toggle_dollar(decoded_r: redis.Redis): await decoded_r.json().set( "doc1", diff --git a/tests/test_asyncio/test_timeseries.py b/tests/test_asyncio/test_timeseries.py index 540383b1db..48ffdfd889 100644 --- a/tests/test_asyncio/test_timeseries.py +++ b/tests/test_asyncio/test_timeseries.py @@ -10,6 +10,7 @@ ) +@pytest.mark.redismod async def test_create(decoded_r: redis.Redis): assert await decoded_r.ts().create(1) assert await decoded_r.ts().create(2, retention_msecs=5) @@ -27,6 +28,7 @@ async def test_create(decoded_r: redis.Redis): assert_resp_response(decoded_r, 128, info.get("chunk_size"), info.get("chunkSize")) +@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def test_create_duplicate_policy(decoded_r: redis.Redis): # Test for duplicate policy @@ -42,6 +44,7 @@ async def test_create_duplicate_policy(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_alter(decoded_r: redis.Redis): assert await decoded_r.ts().create(1) res = await decoded_r.ts().info(1) @@ -64,6 +67,7 @@ async def test_alter(decoded_r: redis.Redis): ) +@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def test_alter_diplicate_policy(decoded_r: redis.Redis): assert await decoded_r.ts().create(1) @@ -78,6 +82,7 @@ async def test_alter_diplicate_policy(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_add(decoded_r: redis.Redis): assert 1 == await decoded_r.ts().add(1, 1, 1) assert 2 == await decoded_r.ts().add(2, 2, 3, retention_msecs=10) @@ -100,6 +105,7 @@ async def test_add(decoded_r: redis.Redis): assert_resp_response(decoded_r, 128, info.get("chunk_size"), info.get("chunkSize")) +@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def test_add_duplicate_policy(r: redis.Redis): @@ -141,6 +147,7 @@ async def test_add_duplicate_policy(r: redis.Redis): assert 5.0 == res[1] +@pytest.mark.redismod async def test_madd(decoded_r: redis.Redis): await decoded_r.ts().create("a") assert [1, 2, 3] == await decoded_r.ts().madd( @@ -148,6 +155,7 @@ async def test_madd(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_incrby_decrby(decoded_r: redis.Redis): for _ in range(100): assert await decoded_r.ts().incrby(1, 1) @@ -176,6 +184,7 @@ async def test_incrby_decrby(decoded_r: redis.Redis): assert_resp_response(decoded_r, 128, info.get("chunk_size"), info.get("chunkSize")) +@pytest.mark.redismod async def test_create_and_delete_rule(decoded_r: redis.Redis): # test rule creation time = 100 @@ -199,6 +208,7 @@ async def test_create_and_delete_rule(decoded_r: redis.Redis): assert not info["rules"] +@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_del_range(decoded_r: redis.Redis): try: @@ -215,6 +225,7 @@ async def test_del_range(decoded_r: redis.Redis): ) +@pytest.mark.redismod async def test_range(r: redis.Redis): for i in range(100): await r.ts().add(1, i, i % 7) @@ -229,6 +240,7 @@ async def test_range(r: redis.Redis): assert 10 == len(await r.ts().range(1, 0, 500, count=10)) +@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_range_advanced(decoded_r: redis.Redis): for i in range(100): @@ -259,6 +271,7 @@ async def test_range_advanced(decoded_r: redis.Redis): assert_resp_response(decoded_r, res, [(0, 2.55), (10, 3.0)], [[0, 2.55], [10, 3.0]]) +@pytest.mark.redismod @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_rev_range(decoded_r: redis.Redis): for i in range(100): @@ -302,6 +315,7 @@ async def test_rev_range(decoded_r: redis.Redis): ) +@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_multi_range(decoded_r: redis.Redis): await decoded_r.ts().create(1, labels={"Test": "This", "team": "ny"}) @@ -356,6 +370,7 @@ async def test_multi_range(decoded_r: redis.Redis): assert {"Test": "This", "team": "ny"} == res["1"][0] +@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_multi_range_advanced(decoded_r: redis.Redis): @@ -473,6 +488,7 @@ async def test_multi_range_advanced(decoded_r: redis.Redis): assert [[0, 5.0], [5, 6.0]] == res["1"][2] +@pytest.mark.redismod @pytest.mark.onlynoncluster @skip_ifmodversion_lt("99.99.99", "timeseries") async def test_multi_reverse_range(decoded_r: redis.Redis): @@ -636,6 +652,7 @@ async def test_multi_reverse_range(decoded_r: redis.Redis): assert [[1, 10.0], [0, 1.0]] == res["1"][2] +@pytest.mark.redismod async def test_get(decoded_r: redis.Redis): name = "test" await decoded_r.ts().create(name) @@ -646,6 +663,7 @@ async def test_get(decoded_r: redis.Redis): assert 4 == (await decoded_r.ts().get(name))[1] +@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_mget(decoded_r: redis.Redis): await decoded_r.ts().create(1, labels={"Test": "This"}) @@ -681,6 +699,7 @@ async def test_mget(decoded_r: redis.Redis): assert {"Taste": "That", "Test": "This"} == res["2"][0] +@pytest.mark.redismod async def test_info(decoded_r: redis.Redis): await decoded_r.ts().create( 1, retention_msecs=5, labels={"currentLabel": "currentData"} @@ -692,6 +711,7 @@ async def test_info(decoded_r: redis.Redis): assert info["labels"]["currentLabel"] == "currentData" +@pytest.mark.redismod @skip_ifmodversion_lt("1.4.0", "timeseries") async def testInfoDuplicatePolicy(decoded_r: redis.Redis): await decoded_r.ts().create( @@ -709,6 +729,7 @@ async def testInfoDuplicatePolicy(decoded_r: redis.Redis): ) +@pytest.mark.redismod @pytest.mark.onlynoncluster async def test_query_index(decoded_r: redis.Redis): await decoded_r.ts().create(1, labels={"Test": "This"}) @@ -720,7 +741,8 @@ async def test_query_index(decoded_r: redis.Redis): ) -# # async def test_pipeline(r: redis.Redis): +# @pytest.mark.redismod +# async def test_pipeline(r: redis.Redis): # pipeline = await r.ts().pipeline() # pipeline.create("with_pipeline") # for i in range(100): @@ -733,6 +755,7 @@ async def test_query_index(decoded_r: redis.Redis): # assert await r.ts().get("with_pipeline")[1] == 99 * 1.1 +@pytest.mark.redismod async def test_uncompressed(decoded_r: redis.Redis): await decoded_r.ts().create("compressed") await decoded_r.ts().create("uncompressed", uncompressed=True) From c0651dee961ca5b7bd29f9ba0f103be1dd207c45 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 00:39:04 +0300 Subject: [PATCH 03/12] fix protocol checking --- redis/commands/bf/__init__.py | 12 ++++++------ redis/commands/helpers.py | 8 ++++++++ redis/commands/json/__init__.py | 4 ++-- redis/commands/timeseries/__init__.py | 4 ++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/redis/commands/bf/__init__.py b/redis/commands/bf/__init__.py index bfa9456879..959358f8e8 100644 --- a/redis/commands/bf/__init__.py +++ b/redis/commands/bf/__init__.py @@ -1,6 +1,6 @@ from redis._parsers.helpers import bool_ok -from ..helpers import parse_to_list +from ..helpers import get_protocol_version, parse_to_list from .commands import * # noqa from .info import BFInfo, CFInfo, CMSInfo, TDigestInfo, TopKInfo @@ -108,7 +108,7 @@ def __init__(self, client, **kwargs): self.commandmixin = CMSCommands self.execute_command = client.execute_command - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: _MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: _MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) @@ -139,7 +139,7 @@ def __init__(self, client, **kwargs): self.commandmixin = TOPKCommands self.execute_command = client.execute_command - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: _MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: _MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) @@ -174,7 +174,7 @@ def __init__(self, client, **kwargs): self.commandmixin = CFCommands self.execute_command = client.execute_command - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: _MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: _MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) @@ -210,7 +210,7 @@ def __init__(self, client, **kwargs): self.commandmixin = TDigestCommands self.execute_command = client.execute_command - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: _MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: _MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) @@ -244,7 +244,7 @@ def __init__(self, client, **kwargs): self.commandmixin = BFCommands self.execute_command = client.execute_command - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: _MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: _MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) diff --git a/redis/commands/helpers.py b/redis/commands/helpers.py index b65cd1a933..324d981d66 100644 --- a/redis/commands/helpers.py +++ b/redis/commands/helpers.py @@ -3,6 +3,7 @@ import string from typing import List, Tuple +import redis from redis.typing import KeysT, KeyT @@ -156,3 +157,10 @@ def stringify_param_value(value): return f'{{{",".join(f"{k}:{stringify_param_value(v)}" for k, v in value.items())}}}' # noqa else: return str(value) + + +def get_protocol_version(client): + if isinstance(client, redis.Redis) or isinstance(client, redis.asyncio.Redis): + return client.connection_pool.connection_kwargs.get("protocol") + elif isinstance(client, redis.cluster.AbstractRedisCluster): + return client.nodes_manager.connection_kwargs.get("protocol") diff --git a/redis/commands/json/__init__.py b/redis/commands/json/__init__.py index e895e6a2ba..e2649b8ad5 100644 --- a/redis/commands/json/__init__.py +++ b/redis/commands/json/__init__.py @@ -2,7 +2,7 @@ import redis -from ..helpers import nativestr +from ..helpers import get_protocol_version, nativestr from .commands import JSONCommands from .decoders import bulk_of_jsons, decode_list @@ -73,7 +73,7 @@ def __init__( self.execute_command = client.execute_command self.MODULE_VERSION = version - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: self._MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: self._MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) diff --git a/redis/commands/timeseries/__init__.py b/redis/commands/timeseries/__init__.py index 498f5118f1..4188b93d70 100644 --- a/redis/commands/timeseries/__init__.py +++ b/redis/commands/timeseries/__init__.py @@ -1,7 +1,7 @@ import redis from redis._parsers.helpers import bool_ok -from ..helpers import parse_to_list +from ..helpers import get_protocol_version, parse_to_list from .commands import ( ALTER_CMD, CREATE_CMD, @@ -56,7 +56,7 @@ def __init__(self, client=None, **kwargs): self.client = client self.execute_command = client.execute_command - if self.client.connection_pool.connection_kwargs.get("protocol") in ["3", 3]: + if get_protocol_version(self.client) in ["3", 3]: self._MODULE_CALLBACKS.update(_RESP3_MODULE_CALLBACKS) else: self._MODULE_CALLBACKS.update(_RESP2_MODULE_CALLBACKS) From 2dd09ff2db2f8735f6a48000701abff136c9e6c1 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 00:46:28 +0300 Subject: [PATCH 04/12] fix tests --- dockers/Dockerfile.cluster | 4 ++-- dockers/cluster.redis.conf | 1 + redis/commands/json/__init__.py | 9 ++------- tests/test_asyncio/test_bloom.py | 2 +- tests/test_bloom.py | 2 +- tests/test_timeseries.py | 2 ++ 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/dockers/Dockerfile.cluster b/dockers/Dockerfile.cluster index 204232a665..eb23efe5c8 100644 --- a/dockers/Dockerfile.cluster +++ b/dockers/Dockerfile.cluster @@ -1,7 +1,7 @@ -FROM redis/redis-stack-server:latest as rss +FROM redis/redis-stack-server:edge as rss COPY dockers/create_cluster.sh /create_cluster.sh -RUN ls -R /opt/redis-stack +RUN /opt/redis-stack RUN chmod a+x /create_cluster.sh ENTRYPOINT [ "/create_cluster.sh"] diff --git a/dockers/cluster.redis.conf b/dockers/cluster.redis.conf index 26da33567a..cd5c08b7b8 100644 --- a/dockers/cluster.redis.conf +++ b/dockers/cluster.redis.conf @@ -1,4 +1,5 @@ protected-mode no +enable-debug-command yes loadmodule /opt/redis-stack/lib/redisearch.so loadmodule /opt/redis-stack/lib/redisgraph.so loadmodule /opt/redis-stack/lib/redistimeseries.so diff --git a/redis/commands/json/__init__.py b/redis/commands/json/__init__.py index e2649b8ad5..01077e6b88 100644 --- a/redis/commands/json/__init__.py +++ b/redis/commands/json/__init__.py @@ -34,6 +34,7 @@ def __init__( self._MODULE_CALLBACKS = { "JSON.ARRPOP": self._decode, "JSON.DEBUG": self._decode, + "JSON.GET": self._decode, "JSON.MERGE": lambda r: r and nativestr(r) == "OK", "JSON.MGET": bulk_of_jsons(self._decode), "JSON.MSET": lambda r: r and nativestr(r) == "OK", @@ -61,13 +62,7 @@ def __init__( "JSON.TOGGLE": self._decode, } - _RESP3_MODULE_CALLBACKS = { - "JSON.GET": lambda response: [ - [self._decode(r) for r in res] for res in response - ] - if response - else response - } + _RESP3_MODULE_CALLBACKS = {} self.client = client self.execute_command = client.execute_command diff --git a/tests/test_asyncio/test_bloom.py b/tests/test_asyncio/test_bloom.py index 0535ddfe02..d0a25e5625 100644 --- a/tests/test_asyncio/test_bloom.py +++ b/tests/test_asyncio/test_bloom.py @@ -365,7 +365,7 @@ async def test_tdigest_reset(decoded_r: redis.Redis): @pytest.mark.redismod -@pytest.mark.experimental +@pytest.mark.onlynoncluster async def test_tdigest_merge(decoded_r: redis.Redis): assert await decoded_r.tdigest().create("to-tDigest", 10) assert await decoded_r.tdigest().create("from-tDigest", 10) diff --git a/tests/test_bloom.py b/tests/test_bloom.py index f049f7fa3f..464a946f54 100644 --- a/tests/test_bloom.py +++ b/tests/test_bloom.py @@ -372,7 +372,7 @@ def test_tdigest_reset(client): ) -@pytest.mark.experimental +@pytest.mark.onlynoncluster def test_tdigest_merge(client): assert client.tdigest().create("to-tDigest", 10) assert client.tdigest().create("from-tDigest", 10) diff --git a/tests/test_timeseries.py b/tests/test_timeseries.py index c8e4bb5393..8cafc62047 100644 --- a/tests/test_timeseries.py +++ b/tests/test_timeseries.py @@ -251,6 +251,7 @@ def test_range_advanced(client): assert_resp_response(client, res, [(0, 2.55), (10, 3.0)], [[0, 2.55], [10, 3.0]]) +@pytest.mark.onlynoncluster @skip_ifmodversion_lt("1.8.0", "timeseries") def test_range_latest(client: redis.Redis): timeseries = client.ts() @@ -399,6 +400,7 @@ def test_rev_range(client): ) +@pytest.mark.onlynoncluster @skip_ifmodversion_lt("1.8.0", "timeseries") def test_revrange_latest(client: redis.Redis): timeseries = client.ts() From e976b3773ff5c17459070f13b7b33d4a620c2016 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 00:52:37 +0300 Subject: [PATCH 05/12] revert cluster docker change --- dockers/Dockerfile.cluster | 4 ++-- dockers/cluster.redis.conf | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dockers/Dockerfile.cluster b/dockers/Dockerfile.cluster index eb23efe5c8..204232a665 100644 --- a/dockers/Dockerfile.cluster +++ b/dockers/Dockerfile.cluster @@ -1,7 +1,7 @@ -FROM redis/redis-stack-server:edge as rss +FROM redis/redis-stack-server:latest as rss COPY dockers/create_cluster.sh /create_cluster.sh -RUN /opt/redis-stack +RUN ls -R /opt/redis-stack RUN chmod a+x /create_cluster.sh ENTRYPOINT [ "/create_cluster.sh"] diff --git a/dockers/cluster.redis.conf b/dockers/cluster.redis.conf index cd5c08b7b8..26da33567a 100644 --- a/dockers/cluster.redis.conf +++ b/dockers/cluster.redis.conf @@ -1,5 +1,4 @@ protected-mode no -enable-debug-command yes loadmodule /opt/redis-stack/lib/redisearch.so loadmodule /opt/redis-stack/lib/redisgraph.so loadmodule /opt/redis-stack/lib/redistimeseries.so From 93c726bf410c520b1ae2821be7ec454da26e29a3 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 13:51:53 +0300 Subject: [PATCH 06/12] skip json 2.6.0 tests --- tests/conftest.py | 1 + tests/test_json.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b3c410e51b..1cd21cafc8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -220,6 +220,7 @@ def skip_unless_arch_bits(arch_bits: int) -> _TestDecorator: def skip_ifmodversion_lt(min_version: str, module_name: str): try: modules = REDIS_INFO["modules"] + breakpoint() except KeyError: return pytest.mark.skipif(True, reason="Redis server does not have modules") if modules == []: diff --git a/tests/test_json.py b/tests/test_json.py index c0f2295a17..baed33d225 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -43,7 +43,7 @@ def test_json_get_jset(client): assert client.exists("foo") == 0 -@skip_ifmodversion_lt("2.6.0", "ReJSON") # todo: update after the release +@skip_ifmodversion_lt("2.06.00", "ReJSON") # todo: update after the release def test_json_merge(client): # Test with root path $ assert client.json().set( @@ -110,7 +110,7 @@ def test_mgetshouldsucceed(client): assert client.json().mget([1, 2], Path.root_path()) == [1, 2] -@skip_ifmodversion_lt("2.6.0", "ReJSON") # todo: update after the release +@skip_ifmodversion_lt("2.06.00", "ReJSON") # todo: update after the release def test_mset(client): client.json().mset([("1", Path.root_path(), 1), ("2", Path.root_path(), 2)]) From 10679f78104cee87fcc38ea57c5dab568fc4c1a2 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 14:08:24 +0300 Subject: [PATCH 07/12] remove breakpoint --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1cd21cafc8..b3c410e51b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -220,7 +220,6 @@ def skip_unless_arch_bits(arch_bits: int) -> _TestDecorator: def skip_ifmodversion_lt(min_version: str, module_name: str): try: modules = REDIS_INFO["modules"] - breakpoint() except KeyError: return pytest.mark.skipif(True, reason="Redis server does not have modules") if modules == []: From 3891b9c6bf01e569119784c3c0f9f8a03c2bd25f Mon Sep 17 00:00:00 2001 From: dvora-h Date: Mon, 17 Jul 2023 14:48:14 +0300 Subject: [PATCH 08/12] skip test_get_latest --- tests/test_timeseries.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_timeseries.py b/tests/test_timeseries.py index 8cafc62047..4ab86cd56e 100644 --- a/tests/test_timeseries.py +++ b/tests/test_timeseries.py @@ -843,6 +843,7 @@ def test_get(client): assert 4 == client.ts().get(name)[1] +@pytest.mark.onlynoncluster @skip_ifmodversion_lt("1.8.0", "timeseries") def test_get_latest(client: redis.Redis): timeseries = client.ts() From b81438d7fb92683317d1fea674edff9614d9d693 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Tue, 1 Aug 2023 12:32:06 +0300 Subject: [PATCH 09/12] skip json.mset --- tests/test_asyncio/test_json.py | 1 + tests/test_json.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_asyncio/test_json.py b/tests/test_asyncio/test_json.py index 6f3e8c3251..ed651cd903 100644 --- a/tests/test_asyncio/test_json.py +++ b/tests/test_asyncio/test_json.py @@ -112,6 +112,7 @@ async def test_mgetshouldsucceed(decoded_r: redis.Redis): @pytest.mark.redismod +@pytest.mark.onlynoncluster @skip_ifmodversion_lt("2.6.0", "ReJSON") async def test_mset(decoded_r: redis.Redis): await decoded_r.json().mset( diff --git a/tests/test_json.py b/tests/test_json.py index baed33d225..be347f6677 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -110,7 +110,8 @@ def test_mgetshouldsucceed(client): assert client.json().mget([1, 2], Path.root_path()) == [1, 2] -@skip_ifmodversion_lt("2.06.00", "ReJSON") # todo: update after the release +@pytest.mark.onlynoncluster +@skip_ifmodversion_lt("2.06.00", "ReJSON") def test_mset(client): client.json().mset([("1", Path.root_path(), 1), ("2", Path.root_path(), 2)]) From 2d5b70b479e4b8f66688eed73f4dccc1fcd28343 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Wed, 2 Aug 2023 12:59:15 +0300 Subject: [PATCH 10/12] type hint --- redis/commands/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redis/commands/helpers.py b/redis/commands/helpers.py index 324d981d66..a90ceefc7c 100644 --- a/redis/commands/helpers.py +++ b/redis/commands/helpers.py @@ -1,7 +1,7 @@ import copy import random import string -from typing import List, Tuple +from typing import List, Tuple, Union import redis from redis.typing import KeysT, KeyT @@ -159,7 +159,7 @@ def stringify_param_value(value): return str(value) -def get_protocol_version(client): +def get_protocol_version(client: redis.Redis) -> Union[int, str, None]: if isinstance(client, redis.Redis) or isinstance(client, redis.asyncio.Redis): return client.connection_pool.connection_kwargs.get("protocol") elif isinstance(client, redis.cluster.AbstractRedisCluster): From 5c533ef96a85f0bc0cc1c3afeea17a8476ab8e45 Mon Sep 17 00:00:00 2001 From: dvora-h Date: Wed, 2 Aug 2023 13:26:30 +0300 Subject: [PATCH 11/12] revert type hints --- redis/commands/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/commands/helpers.py b/redis/commands/helpers.py index a90ceefc7c..53eeeec329 100644 --- a/redis/commands/helpers.py +++ b/redis/commands/helpers.py @@ -159,7 +159,7 @@ def stringify_param_value(value): return str(value) -def get_protocol_version(client: redis.Redis) -> Union[int, str, None]: +def get_protocol_version(client): if isinstance(client, redis.Redis) or isinstance(client, redis.asyncio.Redis): return client.connection_pool.connection_kwargs.get("protocol") elif isinstance(client, redis.cluster.AbstractRedisCluster): From f11f7d36b43c7def43682e1bb66a5ec546086f7d Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:50:46 +0300 Subject: [PATCH 12/12] ilnters --- redis/commands/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/commands/helpers.py b/redis/commands/helpers.py index 53eeeec329..324d981d66 100644 --- a/redis/commands/helpers.py +++ b/redis/commands/helpers.py @@ -1,7 +1,7 @@ import copy import random import string -from typing import List, Tuple, Union +from typing import List, Tuple import redis from redis.typing import KeysT, KeyT