tornado 5 fixes in tests

- start asyncio loop explicitly in notebook thread (tornado 4 starts per-thread loops automatically, asyncio doesn’t)
- remove unsupported ‘io_loop=‘ arg in websocket test

application runs fine with tornado 5, just a few test bits needed updating
This commit is contained in:
Min RK 2018-03-05 23:10:56 +01:00
parent 95a8340063
commit f77e3435cf
2 changed files with 5 additions and 1 deletions

View File

@ -53,11 +53,12 @@ class KernelAPI(object):
def websocket(self, id):
loop = IOLoop()
loop.make_current()
req = HTTPRequest(
url_path_join(self.base_url.replace('http', 'ws', 1), 'api/kernels', id, 'channels'),
headers=self.headers,
)
f = websocket_connect(req, io_loop=loop)
f = websocket_connect(req)
return loop.run_sync(lambda : f)

View File

@ -135,6 +135,9 @@ class NotebookTestBase(TestCase):
started = Event()
def start_thread():
if 'asyncio' in sys.modules:
import asyncio
asyncio.set_event_loop(asyncio.new_event_loop())
app = cls.notebook = NotebookApp(
port=cls.port,
port_retries=0,