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
24
+ @skip_if_resp_version (3 )
23
25
async def test_graph_creation (decoded_r : redis .Redis ):
24
26
graph = decoded_r .graph ()
25
27
@@ -65,6 +67,7 @@ async def test_graph_creation(decoded_r: redis.Redis):
65
67
66
68
67
69
@pytest .mark .redismod
70
+ @skip_if_resp_version (3 )
68
71
async def test_array_functions (decoded_r : redis .Redis ):
69
72
graph = decoded_r .graph ()
70
73
@@ -88,6 +91,7 @@ async def test_array_functions(decoded_r: redis.Redis):
88
91
89
92
90
93
@pytest .mark .redismod
94
+ @skip_if_resp_version (3 )
91
95
async def test_path (decoded_r : redis .Redis ):
92
96
node0 = Node (node_id = 0 , label = "L1" )
93
97
node1 = Node (node_id = 1 , label = "L1" )
@@ -108,6 +112,7 @@ async def test_path(decoded_r: redis.Redis):
108
112
109
113
110
114
@pytest .mark .redismod
115
+ @skip_if_resp_version (3 )
111
116
async def test_param (decoded_r : redis .Redis ):
112
117
params = [1 , 2.3 , "str" , True , False , None , [0 , 1 , 2 ]]
113
118
query = "RETURN $param"
@@ -118,6 +123,7 @@ async def test_param(decoded_r: redis.Redis):
118
123
119
124
120
125
@pytest .mark .redismod
126
+ @skip_if_resp_version (3 )
121
127
async def test_map (decoded_r : redis .Redis ):
122
128
query = "RETURN {a:1, b:'str', c:NULL, d:[1,2,3], e:True, f:{x:1, y:2}}"
123
129
@@ -135,6 +141,7 @@ async def test_map(decoded_r: redis.Redis):
135
141
136
142
137
143
@pytest .mark .redismod
144
+ @skip_if_resp_version (3 )
138
145
async def test_point (decoded_r : redis .Redis ):
139
146
query = "RETURN point({latitude: 32.070794860, longitude: 34.820751118})"
140
147
expected_lat = 32.070794860
@@ -152,6 +159,7 @@ async def test_point(decoded_r: redis.Redis):
152
159
153
160
154
161
@pytest .mark .redismod
162
+ @skip_if_resp_version (3 )
155
163
async def test_index_response (decoded_r : redis .Redis ):
156
164
result_set = await decoded_r .graph ().query ("CREATE INDEX ON :person(age)" )
157
165
assert 1 == result_set .indices_created
@@ -167,6 +175,7 @@ async def test_index_response(decoded_r: redis.Redis):
167
175
168
176
169
177
@pytest .mark .redismod
178
+ @skip_if_resp_version (3 )
170
179
async def test_stringify_query_result (decoded_r : redis .Redis ):
171
180
graph = decoded_r .graph ()
172
181
@@ -221,6 +230,7 @@ async def test_stringify_query_result(decoded_r: redis.Redis):
221
230
222
231
223
232
@pytest .mark .redismod
233
+ @skip_if_resp_version (3 )
224
234
async def test_optional_match (decoded_r : redis .Redis ):
225
235
# Build a graph of form (a)-[R]->(b)
226
236
node0 = Node (node_id = 0 , label = "L1" , properties = {"value" : "a" })
@@ -246,6 +256,7 @@ async def test_optional_match(decoded_r: redis.Redis):
246
256
247
257
248
258
@pytest .mark .redismod
259
+ @skip_if_resp_version (3 )
249
260
async def test_cached_execution (decoded_r : redis .Redis ):
250
261
await decoded_r .graph ().query ("CREATE ()" )
251
262
@@ -266,6 +277,7 @@ async def test_cached_execution(decoded_r: redis.Redis):
266
277
267
278
268
279
@pytest .mark .redismod
280
+ @skip_if_resp_version (3 )
269
281
async def test_slowlog (decoded_r : redis .Redis ):
270
282
create_query = """CREATE
271
283
(:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}),
@@ -280,6 +292,7 @@ async def test_slowlog(decoded_r: redis.Redis):
280
292
281
293
@pytest .mark .xfail (strict = False )
282
294
@pytest .mark .redismod
295
+ @skip_if_resp_version (3 )
283
296
async def test_query_timeout (decoded_r : redis .Redis ):
284
297
# Build a sample graph with 1000 nodes.
285
298
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):
294
307
295
308
296
309
@pytest .mark .redismod
310
+ @skip_if_resp_version (3 )
297
311
async def test_read_only_query (decoded_r : redis .Redis ):
298
312
with pytest .raises (Exception ):
299
313
# Issue a write query, specifying read-only true,
@@ -303,6 +317,7 @@ async def test_read_only_query(decoded_r: redis.Redis):
303
317
304
318
305
319
@pytest .mark .redismod
320
+ @skip_if_resp_version (3 )
306
321
async def test_profile (decoded_r : redis .Redis ):
307
322
q = """UNWIND range(1, 3) AS x CREATE (p:Person {v:x})"""
308
323
profile = (await decoded_r .graph ().profile (q )).result_set
@@ -319,6 +334,7 @@ async def test_profile(decoded_r: redis.Redis):
319
334
320
335
@skip_if_redis_enterprise ()
321
336
@pytest .mark .redismod
337
+ @skip_if_resp_version (3 )
322
338
async def test_config (decoded_r : redis .Redis ):
323
339
config_name = "RESULTSET_SIZE"
324
340
config_value = 3
@@ -351,6 +367,7 @@ async def test_config(decoded_r: redis.Redis):
351
367
352
368
@pytest .mark .onlynoncluster
353
369
@pytest .mark .redismod
370
+ @skip_if_resp_version (3 )
354
371
async def test_list_keys (decoded_r : redis .Redis ):
355
372
result = await decoded_r .graph ().list_keys ()
356
373
assert result == []
@@ -374,6 +391,7 @@ async def test_list_keys(decoded_r: redis.Redis):
374
391
375
392
376
393
@pytest .mark .redismod
394
+ @skip_if_resp_version (3 )
377
395
async def test_multi_label (decoded_r : redis .Redis ):
378
396
redis_graph = decoded_r .graph ("g" )
379
397
@@ -400,6 +418,7 @@ async def test_multi_label(decoded_r: redis.Redis):
400
418
401
419
402
420
@pytest .mark .redismod
421
+ @skip_if_resp_version (3 )
403
422
async def test_execution_plan (decoded_r : redis .Redis ):
404
423
redis_graph = decoded_r .graph ("execution_plan" )
405
424
create_query = """CREATE
@@ -419,6 +438,7 @@ async def test_execution_plan(decoded_r: redis.Redis):
419
438
420
439
421
440
@pytest .mark .redismod
441
+ @skip_if_resp_version (3 )
422
442
async def test_explain (decoded_r : redis .Redis ):
423
443
redis_graph = decoded_r .graph ("execution_plan" )
424
444
# graph creation / population
0 commit comments