File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,17 @@ def jp_argv(request):
13
13
return ["--ServerApp.kernel_manager_class=jupyter_server.services.kernels.kernelmanager." + request .param ]
14
14
15
15
16
- CULL_TIMEOUT = 10 if platform .python_implementation () == 'PyPy' else 2
16
+ CULL_TIMEOUT = 10 if platform .python_implementation () == 'PyPy' else 5
17
+ CULL_INTERVAL = 1
18
+
17
19
18
20
@pytest .fixture
19
21
def jp_server_config ():
20
22
return Config ({
21
23
'ServerApp' : {
22
24
'MappingKernelManager' : {
23
25
'cull_idle_timeout' : CULL_TIMEOUT ,
24
- 'cull_interval' : 1 ,
26
+ 'cull_interval' : CULL_INTERVAL ,
25
27
'cull_connected' : False
26
28
}
27
29
}
@@ -56,18 +58,19 @@ async def test_culling(jp_fetch, jp_ws_fetch):
56
58
57
59
58
60
async def get_cull_status (kid , jp_fetch ):
61
+ frequency = 0.5
59
62
culled = False
60
- for i in range (20 ) : # Need max of 2x culling PERIOD ensure culling timeout exceeded
63
+ for _ in range (int (( CULL_TIMEOUT + CULL_INTERVAL ) / frequency )) : # Timeout + Interval will ensure cull
61
64
try :
62
65
r = await jp_fetch (
63
66
'api' , 'kernels' , kid ,
64
67
method = 'GET'
65
68
)
66
- kernel = json .loads (r .body .decode ())
69
+ json .loads (r .body .decode ())
67
70
except HTTPClientError as e :
68
71
assert e .code == 404
69
72
culled = True
70
73
break
71
74
else :
72
- await asyncio .sleep (CULL_TIMEOUT / 10. )
73
- return culled
75
+ await asyncio .sleep (frequency )
76
+ return culled
You can’t perform that action at this time.
0 commit comments