From 9363dd1087a2995d5f0165dea8caf33c6627db69 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Wed, 8 Jan 2014 14:26:48 -0800 Subject: [PATCH] Simplify waiting for notebook server to die. --- IPython/html/tests/launchnotebook.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/IPython/html/tests/launchnotebook.py b/IPython/html/tests/launchnotebook.py index d9ef86f4d..9171934d9 100644 --- a/IPython/html/tests/launchnotebook.py +++ b/IPython/html/tests/launchnotebook.py @@ -39,15 +39,11 @@ class NotebookTestBase(TestCase): @classmethod def wait_until_dead(cls): - """Wait for the server to stop getting requests after shutdown""" - url = 'http://localhost:%i/api/notebooks' % cls.port + """Wait for the server process to terminate after shutdown""" for _ in range(300): - try: - requests.get(url) - except requests.exceptions.ConnectionError: - break - else: - time.sleep(.1) + if cls.notebook.poll() is not None: + return + time.sleep(.1) raise TimeoutError("Undead notebook server")