File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -196,9 +196,17 @@ def test_autocommit_transactions_should_support_timeout(neo4j_driver):
196196 with neo4j_driver .session () as s2 :
197197 tx1 = s1 .begin_transaction ()
198198 tx1 .run ("MATCH (a:Node) SET a.property = 1" ).consume ()
199- with pytest . raises ( TransientError ) :
199+ try :
200200 result = s2 .run (Query ("MATCH (a:Node) SET a.property = 2" , timeout = 0.25 ))
201201 result .consume ()
202+ # On 4.0 and older
203+ except TransientError :
204+ pass
205+ # On 4.1 and forward
206+ except ClientError :
207+ pass
208+ else :
209+ raise
202210
203211
204212def test_regex_in_parameter (session ):
Original file line number Diff line number Diff line change @@ -160,8 +160,16 @@ def test_transaction_timeout(driver):
160160 tx1 = s1 .begin_transaction ()
161161 tx1 .run ("MATCH (a:Node) SET a.property = 1" ).consume ()
162162 tx2 = s2 .begin_transaction (timeout = 0.25 )
163- with pytest . raises ( TransientError ) :
163+ try :
164164 tx2 .run ("MATCH (a:Node) SET a.property = 2" ).consume ()
165+ # On 4.0 and older
166+ except TransientError :
167+ pass
168+ # On 4.1 and forward
169+ except ClientError :
170+ pass
171+ else :
172+ raise
165173
166174
167175# TODO: Re-enable and test when TC is available again
Original file line number Diff line number Diff line change 2020
2121import pytest
2222
23+ def get_operator_type (op ):
24+ # Fabric will suffix with db name, remove this to handle fabric on/off
25+ op = op .split ("@" )
26+ return op [0 ]
27+
2328
2429def test_can_obtain_summary_after_consuming_result (session ):
2530 # python -m pytest tests/integration/test_summary.py -s -v -k test_can_obtain_summary_after_consuming_result
@@ -43,7 +48,7 @@ def test_can_obtain_plan_info(session):
4348 result = session .run ("EXPLAIN CREATE (n) RETURN n" )
4449 summary = result .consume ()
4550 plan = summary .plan
46- assert plan .operator_type == "ProduceResults"
51+ assert get_operator_type ( plan .operator_type ) == "ProduceResults"
4752 assert plan .identifiers == ["n" ]
4853 assert len (plan .children ) == 1
4954
@@ -54,7 +59,7 @@ def test_can_obtain_profile_info(session):
5459 profile = summary .profile
5560 assert profile .db_hits == 0
5661 assert profile .rows == 1
57- assert profile .operator_type == "ProduceResults"
62+ assert get_operator_type ( profile .operator_type ) == "ProduceResults"
5863 assert profile .identifiers == ["n" ]
5964 assert len (profile .children ) == 1
6065
You can’t perform that action at this time.
0 commit comments