WaterButler is a Python web application for interacting with various file storage services via a single RESTful API, developed at Center for Open Science.
RequestHandler._headers[<header_name>] returns a byte string in 4.3 but a string in 4.4. This affects tests where we had to do byte-str conversion before/during comparison, which breaks and is no longer needed as well.
In tornado, setting debug=True automatically sets autoreload=True. Starting 5.0, autoreload breaks WB unit tests where WB's ProviderHandler (inherits tornado's RequestHandler) is declared as a fixture. Every other test throws "RuntimeError: Event loop is closed", probably caused by sharing the handler and thus the event loop which has been closed in the one test before the current one.
Further improvement (optional)
Refactored mock handler from a test fixture (which is shared between tests) to a utility function (which gets called by each test). This fixes the "closed event loop" issue caused by autoreload in tornado 5.0 breaking shared request handler in tests.
Side effects
No
QA Notes
Although this PR is part of the prerequisites for aiohttp3 upgrade, it is recommended to test WB with only this tornado upgrade. Full regression test is required if this follows staging 1 -> test -> prod path. Otherwise if goes to staging 3 (or another dedicated aiohttp3 server), probably quick spot checking is good enough.
Coverage increased (+0.01%) to 91.863% when pulling 403991c0a0f64dff78039d61b0aa436d69ee5d08 on cslzchen:feature/upgrade-tornado into 2cc62a1ef2c426238271d5d58a4473acecf0878e on CenterForOpenScience:develop.
Ticket
https://openscience.atlassian.net/browse/ENG-374
Purpose
Upgrade
tornado
from 4.3 to 5.1.1, required foraiohttp
0.18->3.5 upgradeChanges
AsyncIOMainLoop
asyncio
event loop. See http://www.tornadoweb.org/en/stable/asyncio.html for detailed info.RequestHandler._headers[<header_name>]
returns a byte string in 4.3 but a string in 4.4. This affects tests where we had to do byte-str conversion before/during comparison, which breaks and is no longer needed as well.debug=True
automatically setsautoreload=True
. Starting 5.0,autoreload
breaks WB unit tests where WB'sProviderHandler
(inherits tornado'sRequestHandler
) is declared as a fixture. Every other test throws "RuntimeError: Event loop is closed", probably caused by sharing the handler and thus the event loop which has been closed in the one test before the current one.autoreload
in tornado 5.0 breaking shared request handler in tests.Side effects
No
QA Notes
Although this PR is part of the prerequisites for aiohttp3 upgrade, it is recommended to test WB with only this tornado upgrade. Full regression test is required if this follows staging 1 -> test -> prod path. Otherwise if goes to staging 3 (or another dedicated aiohttp3 server), probably quick spot checking is good enough.
Deployment Notes
No