Skip to content

Commit f5fa654

Browse files
author
Peter Wilhelmsson
committed
Make tests green when running against 4.1 db
1 parent e94ed50 commit f5fa654

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

tests/integration/test_autocommit.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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

204212
def test_regex_in_parameter(session):

tests/integration/test_explicit_tx.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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

tests/integration/test_summary.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
import 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

2429
def 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

0 commit comments

Comments
 (0)