##// END OF EJS Templates
Don't hang tests if notebook server fails to terminate.
MinRK -
Show More
@@ -6,16 +6,9 b' test suite.'
6
6
7 """
7 """
8
8
9 #-----------------------------------------------------------------------------
9 # Copyright (c) IPython Development Team.
10 # Copyright (C) 2009-2011 The IPython Development Team
10 # Distributed under the terms of the Modified BSD License.
11 #
11
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
14 #-----------------------------------------------------------------------------
15
16 #-----------------------------------------------------------------------------
17 # Imports
18 #-----------------------------------------------------------------------------
19 from __future__ import print_function
12 from __future__ import print_function
20
13
21 import argparse
14 import argparse
@@ -34,6 +27,7 b' from IPython.utils.py3compat import bytes_to_str'
34 from IPython.utils.sysinfo import get_sys_info
27 from IPython.utils.sysinfo import get_sys_info
35 from IPython.utils.tempdir import TemporaryDirectory
28 from IPython.utils.tempdir import TemporaryDirectory
36
29
30 NOTEBOOK_SHUTDOWN_TIMEOUT = 10
37
31
38 class TestController(object):
32 class TestController(object):
39 """Run tests in a subprocess
33 """Run tests in a subprocess
@@ -287,7 +281,27 b' class JSController(TestController):'
287 except OSError:
281 except OSError:
288 # already dead
282 # already dead
289 pass
283 pass
290 self.server.wait()
284 # wait 10s for the server to shutdown
285 try:
286 self.server.wait(NOTEBOOK_SHUTDOWN_TIMEOUT)
287 except subprocess.TimeoutExpired:
288 # server didn't terminate, kill it
289 try:
290 print("Failed to terminate notebook server, killing it.",
291 file=sys.stderr
292 )
293 self.server.kill()
294 except OSError:
295 # already dead
296 pass
297 # wait another 10s
298 try:
299 self.server.wait(NOTEBOOK_SHUTDOWN_TIMEOUT)
300 except subprocess.TimeoutExpired:
301 print("Notebook server still running (%s)" % self.server_info_file,
302 file=sys.stderr
303 )
304
291 self.stream_capturer.halt()
305 self.stream_capturer.halt()
292 TestController.cleanup(self)
306 TestController.cleanup(self)
293
307
General Comments 0
You need to be logged in to leave comments. Login now