Skip to content

Commit 3f63ac9

Browse files
akchinSTClresende
authored andcommitted
Update Kernel Gateway test base class to be compatible with Tornado 5.0
Fixes #281 Closes #285
1 parent c1a1c50 commit 3f63ac9

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

kernel_gateway/tests/test_gatewayapp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
from kernel_gateway.gatewayapp import KernelGatewayApp, ioloop
99
from ..notebook_http.swagger.handlers import SwaggerSpecHandler
10-
from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase
10+
from tornado.testing import AsyncHTTPTestCase, ExpectLog
1111

1212
RESOURCES = os.path.join(os.path.dirname(__file__), 'resources')
1313

@@ -66,7 +66,7 @@ def test_config_env_vars(self):
6666
self.assertEqual(app.certfile, '/test/fake.crt')
6767
self.assertEqual(app.client_ca, '/test/fake_ca.crt')
6868

69-
class TestGatewayAppBase(AsyncHTTPTestCase, LogTrapTestCase):
69+
class TestGatewayAppBase(AsyncHTTPTestCase, ExpectLog):
7070
"""Base class for integration style tests using HTTP/Websockets against an
7171
instance of the gateway app.
7272

kernel_gateway/tests/test_notebook_http.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,25 @@ def test_concurrent_request_should_not_be_blocked(self):
381381
method='GET',
382382
raise_error=False
383383
)
384-
self.assertTrue(response_long_running.running(), 'Long HTTP Request is not running')
384+
if callable(getattr(response_long_running, 'done', "")):
385+
# Tornado 5
386+
self.assertFalse(response_long_running.done(), 'Long HTTP Request is not running')
387+
else:
388+
# Tornado 4
389+
self.assertTrue(response_long_running.running(), 'Long HTTP Request is not running')
390+
385391
response_short_running = yield self.http_client.fetch(
386392
self.get_url('/sleep/3'),
387393
method='GET',
388394
raise_error=False
389395
)
390-
self.assertTrue(response_long_running.running(), 'Long HTTP Request is not running')
396+
if callable(getattr(response_long_running, 'done', "")):
397+
# Tornado 5
398+
self.assertFalse(response_long_running.done(), 'Long HTTP Request is not running')
399+
else:
400+
# Tornado 4
401+
self.assertTrue(response_long_running.running(), 'Long HTTP Request is not running')
402+
391403
self.assertEqual(response_short_running.code, 200, 'Short HTTP Request did not return proper status code of 200')
392404

393405
@gen_test

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ jupyter_core>=4.0
22
jupyter_client>=4.2.0
33
notebook>=5.0.0
44
traitlets>=4.2.0
5-
tornado>=4.2.0,<5.0
5+
tornado>=4.2.0
66
requests>=2.7,<3.0

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
'jupyter_client>=4.2.0',
5858
'notebook>=5.0.0,<6.0',
5959
'traitlets>=4.2.0',
60-
'tornado>=4.2.0,<5.0',
60+
'tornado>=4.2.0',
6161
'requests>=2.7,<3.0'
6262
],
6363
classifiers=[

0 commit comments

Comments
 (0)