@@ -335,15 +335,15 @@ def test_automatic_reset_after_failure(self):
335335 else :
336336 assert False , "A Cypher error should have occurred"
337337
338- # def test_defunct(self):
339- # from neo4j.v1.connection import ChunkChannel, ProtocolError
340- # with GraphDatabase.driver("bolt://localhost", auth=auth_token).session() as session:
341- # assert not session.connection.defunct
342- # with patch.object(ChunkChannel, "chunk_reader", side_effect=ProtocolError()):
343- # with self.assertRaises(ProtocolError):
344- # session.run("RETURN 1").consume()
345- # assert session.connection.defunct
346- # assert session.connection.closed
338+ def test_defunct (self ):
339+ from neo4j .v1 .connection import ChunkChannel , ProtocolError
340+ with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
341+ assert not session .connection .defunct
342+ with patch .object (ChunkChannel , "chunk_reader" , side_effect = ProtocolError ()):
343+ with self .assertRaises (ProtocolError ):
344+ session .run ("RETURN 1" ).consume ()
345+ assert session .connection .defunct
346+ assert session .connection .closed
347347
348348
349349class RecordTestCase (ServerTestCase ):
0 commit comments