4
4
from redis .commands .graph import Edge , Node , Path
5
5
from redis .commands .graph .execution_plan import Operation
6
6
from 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
8
8
9
9
10
10
@pytest_asyncio .fixture ()
11
11
async 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" )
13
13
14
14
15
15
@pytest .mark .redismod
16
+ @skip_if_resp_version (3 )
16
17
async def test_bulk (decoded_r ):
17
18
with pytest .raises (NotImplementedError ):
18
19
await decoded_r .graph ().bulk ()
19
20
await decoded_r .graph ().bulk (foo = "bar!" )
20
21
21
22
22
23
@pytest .mark .redismod
23
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
24
+ @skip_if_resp_version ( 3 )
24
25
async def test_graph_creation (decoded_r : redis .Redis ):
25
26
graph = decoded_r .graph ()
26
27
@@ -66,7 +67,7 @@ async def test_graph_creation(decoded_r: redis.Redis):
66
67
67
68
68
69
@pytest .mark .redismod
69
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
70
+ @skip_if_resp_version ( 3 )
70
71
async def test_array_functions (decoded_r : redis .Redis ):
71
72
graph = decoded_r .graph ()
72
73
@@ -90,7 +91,7 @@ async def test_array_functions(decoded_r: redis.Redis):
90
91
91
92
92
93
@pytest .mark .redismod
93
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
94
+ @skip_if_resp_version ( 3 )
94
95
async def test_path (decoded_r : redis .Redis ):
95
96
node0 = Node (node_id = 0 , label = "L1" )
96
97
node1 = Node (node_id = 1 , label = "L1" )
@@ -111,7 +112,7 @@ async def test_path(decoded_r: redis.Redis):
111
112
112
113
113
114
@pytest .mark .redismod
114
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
115
+ @skip_if_resp_version ( 3 )
115
116
async def test_param (decoded_r : redis .Redis ):
116
117
params = [1 , 2.3 , "str" , True , False , None , [0 , 1 , 2 ]]
117
118
query = "RETURN $param"
@@ -122,7 +123,7 @@ async def test_param(decoded_r: redis.Redis):
122
123
123
124
124
125
@pytest .mark .redismod
125
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
126
+ @skip_if_resp_version ( 3 )
126
127
async def test_map (decoded_r : redis .Redis ):
127
128
query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}"
128
129
@@ -140,7 +141,7 @@ async def test_map(decoded_r: redis.Redis):
140
141
141
142
142
143
@pytest .mark .redismod
143
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
144
+ @skip_if_resp_version ( 3 )
144
145
async def test_point (decoded_r : redis .Redis ):
145
146
query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})"
146
147
expected_lat = 32.070794860
@@ -158,7 +159,7 @@ async def test_point(decoded_r: redis.Redis):
158
159
159
160
160
161
@pytest .mark .redismod
161
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
162
+ @skip_if_resp_version ( 3 )
162
163
async def test_index_response (decoded_r : redis .Redis ):
163
164
result_set = await decoded_r .graph ().query ("CREATE INDEX ON :person(age)" )
164
165
assert 1 == result_set .indices_created
@@ -174,7 +175,7 @@ async def test_index_response(decoded_r: redis.Redis):
174
175
175
176
176
177
@pytest .mark .redismod
177
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
178
+ @skip_if_resp_version ( 3 )
178
179
async def test_stringify_query_result (decoded_r : redis .Redis ):
179
180
graph = decoded_r .graph ()
180
181
@@ -229,7 +230,7 @@ async def test_stringify_query_result(decoded_r: redis.Redis):
229
230
230
231
231
232
@pytest .mark .redismod
232
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
233
+ @skip_if_resp_version ( 3 )
233
234
async def test_optional_match (decoded_r : redis .Redis ):
234
235
# Build a graph of form (a)-[R]->(b)
235
236
node0 = Node (node_id = 0 , label = "L1" , properties = {"value" : "a" })
@@ -255,7 +256,7 @@ async def test_optional_match(decoded_r: redis.Redis):
255
256
256
257
257
258
@pytest .mark .redismod
258
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
259
+ @skip_if_resp_version ( 3 )
259
260
async def test_cached_execution (decoded_r : redis .Redis ):
260
261
await decoded_r .graph ().query ("CREATE ()" )
261
262
@@ -276,7 +277,7 @@ async def test_cached_execution(decoded_r: redis.Redis):
276
277
277
278
278
279
@pytest .mark .redismod
279
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
280
+ @skip_if_resp_version ( 3 )
280
281
async def test_slowlog (decoded_r : redis .Redis ):
281
282
create_query = """CREATE
282
283
(:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}),
@@ -291,7 +292,7 @@ async def test_slowlog(decoded_r: redis.Redis):
291
292
292
293
@pytest .mark .xfail (strict = False )
293
294
@pytest .mark .redismod
294
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
295
+ @skip_if_resp_version ( 3 )
295
296
async def test_query_timeout (decoded_r : redis .Redis ):
296
297
# Build a sample graph with 1000 nodes.
297
298
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):
306
307
307
308
308
309
@pytest .mark .redismod
309
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
310
+ @skip_if_resp_version ( 3 )
310
311
async def test_read_only_query (decoded_r : redis .Redis ):
311
312
with pytest .raises (Exception ):
312
313
# Issue a write query, specifying read-only true,
@@ -316,7 +317,7 @@ async def test_read_only_query(decoded_r: redis.Redis):
316
317
317
318
318
319
@pytest .mark .redismod
319
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
320
+ @skip_if_resp_version ( 3 )
320
321
async def test_profile (decoded_r : redis .Redis ):
321
322
q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})"""
322
323
profile = (await decoded_r .graph ().profile (q )).result_set
@@ -333,7 +334,7 @@ async def test_profile(decoded_r: redis.Redis):
333
334
334
335
@skip_if_redis_enterprise ()
335
336
@pytest .mark .redismod
336
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
337
+ @skip_if_resp_version ( 3 )
337
338
async def test_config (decoded_r : redis .Redis ):
338
339
config_name = "RESULTSET_SIZE"
339
340
config_value = 3
@@ -366,7 +367,7 @@ async def test_config(decoded_r: redis.Redis):
366
367
367
368
@pytest .mark .onlynoncluster
368
369
@pytest .mark .redismod
369
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
370
+ @skip_if_resp_version ( 3 )
370
371
async def test_list_keys (decoded_r : redis .Redis ):
371
372
result = await decoded_r .graph ().list_keys ()
372
373
assert result == []
@@ -390,7 +391,7 @@ async def test_list_keys(decoded_r: redis.Redis):
390
391
391
392
392
393
@pytest .mark .redismod
393
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
394
+ @skip_if_resp_version ( 3 )
394
395
async def test_multi_label (decoded_r : redis .Redis ):
395
396
redis_graph = decoded_r .graph ("g" )
396
397
@@ -417,7 +418,7 @@ async def test_multi_label(decoded_r: redis.Redis):
417
418
418
419
419
420
@pytest .mark .redismod
420
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
421
+ @skip_if_resp_version ( 3 )
421
422
async def test_execution_plan (decoded_r : redis .Redis ):
422
423
redis_graph = decoded_r .graph ("execution_plan" )
423
424
create_query = """CREATE
@@ -437,7 +438,7 @@ async def test_execution_plan(decoded_r: redis.Redis):
437
438
438
439
439
440
@pytest .mark .redismod
440
- @pytest . mark . skip ( reason = "Graph module removed from Redis Stack" )
441
+ @skip_if_resp_version ( 3 )
441
442
async def test_explain (decoded_r : redis .Redis ):
442
443
redis_graph = decoded_r .graph ("execution_plan" )
443
444
# graph creation / population
0 commit comments