Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions tests/neo4j/test_tx_func_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,20 @@ def update2(tx):
with self.assertRaises(types.DriverError) as e:
tx.run("MATCH (a:Node) SET a.property = 2").consume()
exc = e.exception
if (exc.code
# TODO REMOVE THIS BLOCK ONCE ALL IMPLEMENT RETRYABLE EXCEPTIONS
if (get_driver_name() in ["javascript", "ruby", "python"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest to not put Ruby in there? Once the community driver implements the 5.0 changes, I think it should be notified of this required change through a failing pipeline.

and exc.code
!= "Neo.TransientError.Transaction.LockClientStopped"):
# This is not the error we are looking for. Maybe there was a
# leader election or so. Give the driver the chance to retry.
raise exc
else:
elif exc.code != "Neo.ClientError.Transaction.LockClientStopped":
# This is not the error we are looking for. Maybe there was a
# leader election or so. Give the driver the chance to retry.
raise exc
# The error we are looking for. Raise ApplicationError instead
# to make the driver stop retrying.
else:
raise ApplicationCodeError("Stop, hammer time!")

exc = None
Expand All @@ -221,8 +227,17 @@ def update2(tx):
)
self._session1.write_transaction(update1)
self.assertIsInstance(exc, types.DriverError)
self.assertEqual(exc.code,
"Neo.TransientError.Transaction.LockClientStopped")
if get_driver_name() in ["python"]:
self.assertEqual(exc.errorType,
"<class 'neo4j.exceptions.TransientError'>")
# TODO REMOVE THIS BLOCK ONCE ALL IMPLEMENT RETRYABLE EXCEPTIONS
if get_driver_name() in ["javascript", "ruby", "python"]:
self.assertEqual(
exc.code,
"Neo.TransientError.Transaction.LockClientStopped")
if get_driver_name() in ["python"]:
self.assertEqual(exc.errorType,
"<class 'neo4j.exceptions.TransientError'>")
else:
self.assertEqual(exc.code,
"Neo.ClientError.Transaction.LockClientStopped")
if get_driver_name() in ["python"]:
self.assertEqual(exc.errorType,
"<class 'neo4j.exceptions.ClientError'>")