mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Merge pull request #5759 from minrk/travis-3.4
test with Python 3.4 on Travis
This commit is contained in:
commit
c4e0ef142b
@ -127,7 +127,10 @@ class ZMQChannelHandler(AuthenticatedZMQStreamHandler):
|
||||
# closed before the ZMQ streams are setup, they could be None.
|
||||
if self.zmq_stream is not None and not self.zmq_stream.closed():
|
||||
self.zmq_stream.on_recv(None)
|
||||
# close the socket directly, don't wait for the stream
|
||||
socket = self.zmq_stream.socket
|
||||
self.zmq_stream.close()
|
||||
socket.close()
|
||||
|
||||
|
||||
class IOPubHandler(ZMQChannelHandler):
|
||||
|
@ -6,16 +6,9 @@ test suite.
|
||||
|
||||
"""
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (C) 2009-2011 The IPython Development Team
|
||||
#
|
||||
# Distributed under the terms of the BSD License. The full license is in
|
||||
# the file COPYING, distributed as part of this software.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) IPython Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Imports
|
||||
#-----------------------------------------------------------------------------
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
@ -34,6 +27,24 @@ from IPython.utils.py3compat import bytes_to_str
|
||||
from IPython.utils.sysinfo import get_sys_info
|
||||
from IPython.utils.tempdir import TemporaryDirectory
|
||||
|
||||
try:
|
||||
# Python >= 3.3
|
||||
from subprocess import TimeoutExpired
|
||||
def popen_wait(p, timeout):
|
||||
return p.wait(timeout)
|
||||
except ImportError:
|
||||
class TimeoutExpired(Exception):
|
||||
pass
|
||||
def popen_wait(p, timeout):
|
||||
"""backport of Popen.wait from Python 3"""
|
||||
for i in range(int(10 * timeout)):
|
||||
if p.poll() is not None:
|
||||
return
|
||||
time.sleep(0.1)
|
||||
if p.poll() is None:
|
||||
raise TimeoutExpired
|
||||
|
||||
NOTEBOOK_SHUTDOWN_TIMEOUT = 10
|
||||
|
||||
class TestController(object):
|
||||
"""Run tests in a subprocess
|
||||
@ -287,7 +298,27 @@ class JSController(TestController):
|
||||
except OSError:
|
||||
# already dead
|
||||
pass
|
||||
self.server.wait()
|
||||
# wait 10s for the server to shutdown
|
||||
try:
|
||||
popen_wait(self.server, NOTEBOOK_SHUTDOWN_TIMEOUT)
|
||||
except TimeoutExpired:
|
||||
# server didn't terminate, kill it
|
||||
try:
|
||||
print("Failed to terminate notebook server, killing it.",
|
||||
file=sys.stderr
|
||||
)
|
||||
self.server.kill()
|
||||
except OSError:
|
||||
# already dead
|
||||
pass
|
||||
# wait another 10s
|
||||
try:
|
||||
popen_wait(self.server, NOTEBOOK_SHUTDOWN_TIMEOUT)
|
||||
except TimeoutExpired:
|
||||
print("Notebook server still running (%s)" % self.server_info_file,
|
||||
file=sys.stderr
|
||||
)
|
||||
|
||||
self.stream_capturer.halt()
|
||||
TestController.cleanup(self)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user