Skip to content

Commit f6e3f44

Browse files
committed
dereference aliased tornado methods/classes
* Tornado v5.0.0 made some old methods/classes aliases for other entities. Per their release notes[1], replace the aliases with direct calls to the aliasee: * Replace tornado.ioloop.IOLoop.instance() with asyncio.get_event_loop(). instance() is an alias to .current(), which (for WB's usage) is an alias to get_event_loop(). * Replace tornado.concurrent.Future with asyncio.Future [1] https://github.com/tornadoweb/tornado/blob/master/docs/releases/v5.0.0.rst
1 parent 4c8930c commit f6e3f44

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from unittest import mock
88

99
import pytest
10-
from tornado import concurrent, testing
10+
from tornado import testing
1111
from tornado.platform.asyncio import AsyncIOMainLoop
1212

1313
from waterbutler.server.app import make_app
@@ -75,7 +75,7 @@ def __init__(self):
7575
super().__init__(tempfile.TemporaryFile())
7676

7777

78-
class MockRequestBody(concurrent.Future):
78+
class MockRequestBody(asyncio.Future):
7979

8080
def __await__(self):
8181
yield None

waterbutler/server/app.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def sig_handler(sig, frame):
22-
io_loop = tornado.ioloop.IOLoop.instance()
22+
io_loop = asyncio.get_event_loop()
2323

2424
def stop_loop():
2525
if len(asyncio.Task.all_tasks(io_loop)) == 0:
@@ -43,7 +43,7 @@ def make_app(debug):
4343
api_to_handlers(v1) +
4444
[(r'/status', handlers.StatusHandler)],
4545
debug=debug,
46-
autoreload=False
46+
autoreload=False,
4747
)
4848
app.sentry_client = AsyncSentryClient(settings.SENTRY_DSN, release=__version__)
4949
return app

0 commit comments

Comments
 (0)