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
23- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
24+ @skip_if_resp_version ( 3 )
2425async def test_graph_creation (decoded_r : redis .Redis ):
2526 graph = decoded_r .graph ()
2627
@@ -66,7 +67,7 @@ async def test_graph_creation(decoded_r: redis.Redis):
6667
6768
6869@pytest .mark .redismod
69- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
70+ @skip_if_resp_version ( 3 )
7071async def test_array_functions (decoded_r : redis .Redis ):
7172 graph = decoded_r .graph ()
7273
@@ -90,7 +91,7 @@ async def test_array_functions(decoded_r: redis.Redis):
9091
9192
9293@pytest .mark .redismod
93- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
94+ @skip_if_resp_version ( 3 )
9495async def test_path (decoded_r : redis .Redis ):
9596 node0 = Node (node_id = 0 , label = "L1" )
9697 node1 = Node (node_id = 1 , label = "L1" )
@@ -111,7 +112,7 @@ async def test_path(decoded_r: redis.Redis):
111112
112113
113114@pytest .mark .redismod
114- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
115+ @skip_if_resp_version ( 3 )
115116async def test_param (decoded_r : redis .Redis ):
116117 params = [1 , 2.3 , "str" , True , False , None , [0 , 1 , 2 ]]
117118 query = "RETURN $param"
@@ -122,7 +123,7 @@ async def test_param(decoded_r: redis.Redis):
122123
123124
124125@pytest .mark .redismod
125- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
126+ @skip_if_resp_version ( 3 )
126127async def test_map (decoded_r : redis .Redis ):
127128 query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}"
128129
@@ -140,7 +141,7 @@ async def test_map(decoded_r: redis.Redis):
140141
141142
142143@pytest .mark .redismod
143- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
144+ @skip_if_resp_version ( 3 )
144145async def test_point (decoded_r : redis .Redis ):
145146 query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})"
146147 expected_lat = 32.070794860
@@ -158,7 +159,7 @@ async def test_point(decoded_r: redis.Redis):
158159
159160
160161@pytest .mark .redismod
161- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
162+ @skip_if_resp_version ( 3 )
162163async def test_index_response (decoded_r : redis .Redis ):
163164 result_set = await decoded_r .graph ().query ("CREATE INDEX ON :person(age)" )
164165 assert 1 == result_set .indices_created
@@ -174,7 +175,7 @@ async def test_index_response(decoded_r: redis.Redis):
174175
175176
176177@pytest .mark .redismod
177- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
178+ @skip_if_resp_version ( 3 )
178179async def test_stringify_query_result (decoded_r : redis .Redis ):
179180 graph = decoded_r .graph ()
180181
@@ -229,7 +230,7 @@ async def test_stringify_query_result(decoded_r: redis.Redis):
229230
230231
231232@pytest .mark .redismod
232- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
233+ @skip_if_resp_version ( 3 )
233234async def test_optional_match (decoded_r : redis .Redis ):
234235 # Build a graph of form (a)-[R]->(b)
235236 node0 = Node (node_id = 0 , label = "L1" , properties = {"value" : "a" })
@@ -255,7 +256,7 @@ async def test_optional_match(decoded_r: redis.Redis):
255256
256257
257258@pytest .mark .redismod
258- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
259+ @skip_if_resp_version ( 3 )
259260async def test_cached_execution (decoded_r : redis .Redis ):
260261 await decoded_r .graph ().query ("CREATE ()" )
261262
@@ -276,7 +277,7 @@ async def test_cached_execution(decoded_r: redis.Redis):
276277
277278
278279@pytest .mark .redismod
279- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
280+ @skip_if_resp_version ( 3 )
280281async def test_slowlog (decoded_r : redis .Redis ):
281282 create_query = """CREATE
282283 (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}),
@@ -291,7 +292,7 @@ async def test_slowlog(decoded_r: redis.Redis):
291292
292293@pytest .mark .xfail (strict = False )
293294@pytest .mark .redismod
294- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
295+ @skip_if_resp_version ( 3 )
295296async def test_query_timeout (decoded_r : redis .Redis ):
296297 # Build a sample graph with 1000 nodes.
297298 await decoded_r .graph ().query ("UNWIND range(0,1000) as val CREATE ({v: val})" )
@@ -306,7 +307,7 @@ async def test_query_timeout(decoded_r: redis.Redis):
306307
307308
308309@pytest .mark .redismod
309- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
310+ @skip_if_resp_version ( 3 )
310311async def test_read_only_query (decoded_r : redis .Redis ):
311312 with pytest .raises (Exception ):
312313 # Issue a write query, specifying read-only true,
@@ -316,7 +317,7 @@ async def test_read_only_query(decoded_r: redis.Redis):
316317
317318
318319@pytest .mark .redismod
319- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
320+ @skip_if_resp_version ( 3 )
320321async def test_profile (decoded_r : redis .Redis ):
321322 q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})"""
322323 profile = (await decoded_r .graph ().profile (q )).result_set
@@ -333,7 +334,7 @@ async def test_profile(decoded_r: redis.Redis):
333334
334335@skip_if_redis_enterprise ()
335336@pytest .mark .redismod
336- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
337+ @skip_if_resp_version ( 3 )
337338async def test_config (decoded_r : redis .Redis ):
338339 config_name = "RESULTSET_SIZE"
339340 config_value = 3
@@ -366,7 +367,7 @@ async def test_config(decoded_r: redis.Redis):
366367
367368@pytest .mark .onlynoncluster
368369@pytest .mark .redismod
369- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
370+ @skip_if_resp_version ( 3 )
370371async def test_list_keys (decoded_r : redis .Redis ):
371372 result = await decoded_r .graph ().list_keys ()
372373 assert result == []
@@ -390,7 +391,7 @@ async def test_list_keys(decoded_r: redis.Redis):
390391
391392
392393@pytest .mark .redismod
393- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
394+ @skip_if_resp_version ( 3 )
394395async def test_multi_label (decoded_r : redis .Redis ):
395396 redis_graph = decoded_r .graph ("g" )
396397
@@ -417,7 +418,7 @@ async def test_multi_label(decoded_r: redis.Redis):
417418
418419
419420@pytest .mark .redismod
420- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
421+ @skip_if_resp_version ( 3 )
421422async def test_execution_plan (decoded_r : redis .Redis ):
422423 redis_graph = decoded_r .graph ("execution_plan" )
423424 create_query = """CREATE
@@ -437,7 +438,7 @@ async def test_execution_plan(decoded_r: redis.Redis):
437438
438439
439440@pytest .mark .redismod
440- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
441+ @skip_if_resp_version ( 3 )
441442async def test_explain (decoded_r : redis .Redis ):
442443 redis_graph = decoded_r .graph ("execution_plan" )
443444 # graph creation / population
0 commit comments