Skip to content

Commit 5c39762

Browse files
authored
Neo4j: verify_connectivity for connection test
The driver offers an API specifically crafted to test if it can successfully connect. This tends to exchange less data than a dummy query and hence should be slightly faster. See also https://neo4j.com/docs/api/python-driver/current/api.html#neo4j.Driver.verify_connectivity
1 parent 7a9490a commit 5c39762

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

neo4j/testcontainers/neo4j/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ def _connect(self) -> None:
7676
with self.get_driver() as driver:
7777
# Drivers may or may not be lazy
7878
# force them to do a round trip to confirm neo4j is working
79-
with driver.session() as session:
80-
session.run("RETURN 1").single()
79+
driver.verify_connectivity()
8180

8281
def get_driver(self, **kwargs) -> Driver:
8382
return GraphDatabase.driver(

0 commit comments

Comments
 (0)