File tree 1 file changed +11
-3
lines changed
notebook/services/kernels/tests
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
"""Test the kernels service API."""
2
2
3
3
import json
4
+ import time
4
5
5
6
import requests
6
7
from tornado .websocket import websocket_connect
@@ -159,11 +160,18 @@ def test_kernel_handler(self):
159
160
def test_connections (self ):
160
161
kid = self .kern_api .start ().json ()['id' ]
161
162
model = self .kern_api .get (kid ).json ()
162
- assert model ['connections' ] == 0
163
+ self . assertEqual ( model ['connections' ], 0 )
163
164
164
165
ws = self .kern_api .websocket (kid )
165
166
model = self .kern_api .get (kid ).json ()
166
- assert model ['connections' ] == 1
167
+ self . assertEqual ( model ['connections' ], 1 )
167
168
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
168
176
model = self .kern_api .get (kid ).json ()
169
- assert model ['connections' ] == 0
177
+ self . assertEqual ( model ['connections' ], 0 )
You can’t perform that action at this time.
0 commit comments