Skip to content

Commit e0a0d28

Browse files
committed
give the server a second to notice that the websocket closed
because travis is slow
1 parent 0cc6665 commit e0a0d28

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

notebook/services/kernels/tests/test_kernels_api.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test the kernels service API."""
22

33
import json
4+
import time
45

56
import requests
67
from tornado.websocket import websocket_connect
@@ -159,11 +160,18 @@ def test_kernel_handler(self):
159160
def test_connections(self):
160161
kid = self.kern_api.start().json()['id']
161162
model = self.kern_api.get(kid).json()
162-
assert model['connections'] == 0
163+
self.assertEqual(model['connections'], 0)
163164

164165
ws = self.kern_api.websocket(kid)
165166
model = self.kern_api.get(kid).json()
166-
assert model['connections'] == 1
167+
self.assertEqual(model['connections'], 1)
167168
ws.close()
169+
# give it some time to close on the other side:
170+
for i in range(10):
171+
model = self.kern_api.get(kid).json()
172+
if model['connections'] > 0:
173+
time.sleep(0.1)
174+
else:
175+
break
168176
model = self.kern_api.get(kid).json()
169-
assert model['connections'] == 0
177+
self.assertEqual(model['connections'], 0)

0 commit comments

Comments
 (0)