mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Simplify waiting for notebook server to die.
This commit is contained in:
parent
b0afd36408
commit
9363dd1087
@ -39,15 +39,11 @@ class NotebookTestBase(TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def wait_until_dead(cls):
|
def wait_until_dead(cls):
|
||||||
"""Wait for the server to stop getting requests after shutdown"""
|
"""Wait for the server process to terminate after shutdown"""
|
||||||
url = 'http://localhost:%i/api/notebooks' % cls.port
|
|
||||||
for _ in range(300):
|
for _ in range(300):
|
||||||
try:
|
if cls.notebook.poll() is not None:
|
||||||
requests.get(url)
|
return
|
||||||
except requests.exceptions.ConnectionError:
|
time.sleep(.1)
|
||||||
break
|
|
||||||
else:
|
|
||||||
time.sleep(.1)
|
|
||||||
|
|
||||||
raise TimeoutError("Undead notebook server")
|
raise TimeoutError("Undead notebook server")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user