44from redis .commands .graph import Edge , Node , Path
55from redis .commands .graph .execution_plan import Operation
66from redis .exceptions import ResponseError
7- from tests .conftest import skip_if_redis_enterprise
7+ from tests .conftest import skip_if_redis_enterprise , skip_if_resp_version
88
99
1010@pytest_asyncio .fixture ()
1111async def decoded_r (create_redis , stack_url ):
12- return await create_redis (decode_responses = True , url = stack_url )
12+ return await create_redis (decode_responses = True , url = "redis://localhost:6480" )
1313
1414
1515@pytest .mark .redismod
16+ @skip_if_resp_version (3 )
1617async def test_bulk (decoded_r ):
1718 with pytest .raises (NotImplementedError ):
1819 await decoded_r .graph ().bulk ()
1920 await decoded_r .graph ().bulk (foo = "bar!" )
2021
2122
2223@pytest .mark .redismod
24+ @skip_if_resp_version (3 )
2325async def test_graph_creation (decoded_r : redis .Redis ):
2426 graph = decoded_r .graph ()
2527
@@ -65,6 +67,7 @@ async def test_graph_creation(decoded_r: redis.Redis):
6567
6668
6769@pytest .mark .redismod
70+ @skip_if_resp_version (3 )
6871async def test_array_functions (decoded_r : redis .Redis ):
6972 graph = decoded_r .graph ()
7073
@@ -88,6 +91,7 @@ async def test_array_functions(decoded_r: redis.Redis):
8891
8992
9093@pytest .mark .redismod
94+ @skip_if_resp_version (3 )
9195async def test_path (decoded_r : redis .Redis ):
9296 node0 = Node (node_id = 0 , label = "L1" )
9397 node1 = Node (node_id = 1 , label = "L1" )
@@ -108,6 +112,7 @@ async def test_path(decoded_r: redis.Redis):
108112
109113
110114@pytest .mark .redismod
115+ @skip_if_resp_version (3 )
111116async def test_param (decoded_r : redis .Redis ):
112117 params = [1 , 2.3 , "str" , True , False , None , [0 , 1 , 2 ]]
113118 query = "RETURN $param"
@@ -118,6 +123,7 @@ async def test_param(decoded_r: redis.Redis):
118123
119124
120125@pytest .mark .redismod
126+ @skip_if_resp_version (3 )
121127async def test_map (decoded_r : redis .Redis ):
122128 query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}"
123129
@@ -135,6 +141,7 @@ async def test_map(decoded_r: redis.Redis):
135141
136142
137143@pytest .mark .redismod
144+ @skip_if_resp_version (3 )
138145async def test_point (decoded_r : redis .Redis ):
139146 query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})"
140147 expected_lat = 32.070794860
@@ -152,6 +159,7 @@ async def test_point(decoded_r: redis.Redis):
152159
153160
154161@pytest .mark .redismod
162+ @skip_if_resp_version (3 )
155163async def test_index_response (decoded_r : redis .Redis ):
156164 result_set = await decoded_r .graph ().query ("CREATE INDEX ON :person(age)" )
157165 assert 1 == result_set .indices_created
@@ -167,6 +175,7 @@ async def test_index_response(decoded_r: redis.Redis):
167175
168176
169177@pytest .mark .redismod
178+ @skip_if_resp_version (3 )
170179async def test_stringify_query_result (decoded_r : redis .Redis ):
171180 graph = decoded_r .graph ()
172181
@@ -221,6 +230,7 @@ async def test_stringify_query_result(decoded_r: redis.Redis):
221230
222231
223232@pytest .mark .redismod
233+ @skip_if_resp_version (3 )
224234async def test_optional_match (decoded_r : redis .Redis ):
225235 # Build a graph of form (a)-[R]->(b)
226236 node0 = Node (node_id = 0 , label = "L1" , properties = {"value" : "a" })
@@ -246,6 +256,7 @@ async def test_optional_match(decoded_r: redis.Redis):
246256
247257
248258@pytest .mark .redismod
259+ @skip_if_resp_version (3 )
249260async def test_cached_execution (decoded_r : redis .Redis ):
250261 await decoded_r .graph ().query ("CREATE ()" )
251262
@@ -266,6 +277,7 @@ async def test_cached_execution(decoded_r: redis.Redis):
266277
267278
268279@pytest .mark .redismod
280+ @skip_if_resp_version (3 )
269281async def test_slowlog (decoded_r : redis .Redis ):
270282 create_query = """CREATE
271283 (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}),
@@ -280,6 +292,7 @@ async def test_slowlog(decoded_r: redis.Redis):
280292
281293@pytest .mark .xfail (strict = False )
282294@pytest .mark .redismod
295+ @skip_if_resp_version (3 )
283296async def test_query_timeout (decoded_r : redis .Redis ):
284297 # Build a sample graph with 1000 nodes.
285298 await decoded_r .graph ().query ("UNWIND range(0,1000) as val CREATE ({v: val})" )
@@ -294,6 +307,7 @@ async def test_query_timeout(decoded_r: redis.Redis):
294307
295308
296309@pytest .mark .redismod
310+ @skip_if_resp_version (3 )
297311async def test_read_only_query (decoded_r : redis .Redis ):
298312 with pytest .raises (Exception ):
299313 # Issue a write query, specifying read-only true,
@@ -303,6 +317,7 @@ async def test_read_only_query(decoded_r: redis.Redis):
303317
304318
305319@pytest .mark .redismod
320+ @skip_if_resp_version (3 )
306321async def test_profile (decoded_r : redis .Redis ):
307322 q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})"""
308323 profile = (await decoded_r .graph ().profile (q )).result_set
@@ -319,6 +334,7 @@ async def test_profile(decoded_r: redis.Redis):
319334
320335@skip_if_redis_enterprise ()
321336@pytest .mark .redismod
337+ @skip_if_resp_version (3 )
322338async def test_config (decoded_r : redis .Redis ):
323339 config_name = "RESULTSET_SIZE"
324340 config_value = 3
@@ -351,6 +367,7 @@ async def test_config(decoded_r: redis.Redis):
351367
352368@pytest .mark .onlynoncluster
353369@pytest .mark .redismod
370+ @skip_if_resp_version (3 )
354371async def test_list_keys (decoded_r : redis .Redis ):
355372 result = await decoded_r .graph ().list_keys ()
356373 assert result == []
@@ -374,6 +391,7 @@ async def test_list_keys(decoded_r: redis.Redis):
374391
375392
376393@pytest .mark .redismod
394+ @skip_if_resp_version (3 )
377395async def test_multi_label (decoded_r : redis .Redis ):
378396 redis_graph = decoded_r .graph ("g" )
379397
@@ -400,6 +418,7 @@ async def test_multi_label(decoded_r: redis.Redis):
400418
401419
402420@pytest .mark .redismod
421+ @skip_if_resp_version (3 )
403422async def test_execution_plan (decoded_r : redis .Redis ):
404423 redis_graph = decoded_r .graph ("execution_plan" )
405424 create_query = """CREATE
@@ -419,6 +438,7 @@ async def test_execution_plan(decoded_r: redis.Redis):
419438
420439
421440@pytest .mark .redismod
441+ @skip_if_resp_version (3 )
422442async def test_explain (decoded_r : redis .Redis ):
423443 redis_graph = decoded_r .graph ("execution_plan" )
424444 # graph creation / population
0 commit comments