Skip to content

Commit cd700cd

Browse files
committed
Fix the ServiceUnavailable test.
1 parent c42a822 commit cd700cd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

test/examples/service_unavailable_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def __init__(self, uri, user, password):
2929

3030
# tag::service-unavailable[]
3131
def addItem(self):
32+
session = self._driver.session()
3233
try:
33-
with self._driver.session() as session:
34-
session.write_transaction(lambda tx: tx.run("CREATE (a:Item)"))
35-
return True
34+
session.write_transaction(lambda tx: tx.run("CREATE (a:Item)"))
35+
return True
3636
except ServiceUnavailable as e:
3737
return False
3838
# end::service-unavailable[]

test/examples/test_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def test_service_unavailable_example(self):
110110
from service_unavailable_example import ServiceUnavailableExample
111111

112112
example = ServiceUnavailableExample(self.bolt_uri, self.user, self.password)
113-
ExamplesTest._stop_server()
113+
ExamplesTest.controller.stop()
114114

115115
self.assertFalse(example.addItem())
116116

117-
ExamplesTest._start_server()
117+
ExamplesTest.controller.start()
118118

119119
def test_session_example(self):
120120
from session_example import SessionExample

0 commit comments

Comments
 (0)