pytest-tornado
A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications.
What it is and what it does
pytest-tornado is a pytest plugin that bridges the gap between pytest's synchronous test model and Tornado's asynchronous event loop. It provides fixtures (io_loop, http_server, http_client, base_url, http_port) and a gen_test marker that let you write tests for Tornado web applications using both generator-based coroutines (yield) and modern async/await syntax. The plugin manages the IOLoop lifecycle per test, spins up temporary HTTP/HTTPS servers, and handles timeouts automatically.
You define a Tornado application as a pytest fixture, then write test functions marked with @pytest.mark.gen_test that can yield or await HTTP requests. The plugin injects fixtures like http_client and base_url so your test can make requests to the test server and verify responses. It also supports HTTPS testing when you provide an ssl_options fixture.
Use it for:
- Test Tornado RequestHandler classes by making HTTP requests through http_client and verifying response codes and body content.
- Write async integration tests that exercise both client and server concurrently using run_sync=False to keep them on the same IOLoop.
- Validate HTTPS endpoints by providing ssl_options and using https_server and https_client fixtures.
- Test WebSocket handlers and other async Tornado features that require a running IOLoop and real HTTP server.
- Migrate legacy Tornado test suites from older test runners to pytest while preserving async test patterns.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that provides fixtures and markers to test asynchronous Tornado web applications, handling async/await and generator-based coroutine tests with built-in HTTP server and client support.
Yes, if you are actively testing a Tornado application and want pytest integration—it eliminates boilerplate for IOLoop and server setup. However, be cautious: the project is abandoned (last release June 2020, no commits since). It works for current Tornado and pytest versions, but you should monitor compatibility and be prepared to fork or switch if breaking changes occur in either dependency. No security vulnerabilities are known.
Install
pytest-tornado on PyPI
pip
pip install pytest-tornadouv
uv add pytest-tornadopoetry
poetry add pytest-tornadoInstalling pytest-tornado
Before you install
Low install friction with a pure-Python wheel. However, the package is abandoned—last release was 2020-06-17 and no commits since then. It remains marked Production/Stable and has seen no security issues, but you should expect no maintenance for compatibility with newer pytest or Tornado versions.
License in practice
Licensed under Apache License 2.0 (permissive), so you can use, modify, and distribute it freely with minimal restrictions. No license-based barriers to adoption.
Quickstart
pip install pytest-tornado
import pytest
import tornado.web
@pytest.fixture
def app():
return tornado.web.Application([(r"/", MyHandler)])
@pytest.mark.gen_test
def test_example(http_client, base_url):
response = yield http_client.fetch(base_url)
assert response.code == 200
Requires pytest and tornado to be installed; gen_test tests default to a 5-second timeout (configurable via ASYNC_TEST_TIMEOUT environment variable or marker argument).
Verify before relying
- Compatibility with current pytest and Tornado major versions (last tested 2020-06-17)
- Whether async/await syntax support is fully stable across all test patterns
- HTTPS testing prerequisites and certificate handling details
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — pytest, tornado, setuptools |
| Maintenance | abandoned — 2,249 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 378,257/month — #7,119 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_tornado-0.8.1-py2.py3-none-any.whl
Keywords: pytest, py.test, tornado, async, asynchronous, testing, unit, tests, plugin
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pytest-tornasyncA pytest plugin that runs native async test…
permissive · top 15,000 on PyPI
threadloopRuns Tornado coroutines from synchronous Python…
permissive · top 15,000 on PyPI
tornadoTornado is a Python web framework and…
permissive · top 1,000 on PyPI
pytest-twistedA pytest plugin that enables testing of…
permissive · top 15,000 on PyPI
terminadoTerminado provides a Tornado websocket backend…
permissive · top 1,000 on PyPI
pytest-aioA pytest plugin that automatically runs async…
permissive · top 15,000 on PyPI
sanic-testingProvides sync and async test clients for…
permissive · top 15,000 on PyPI
pytest-fail-slowA pytest plugin that marks tests as failed if…
permissive · top 15,000 on PyPI
pytest-timeoutAborts pytest tests that exceed a specified…
permissive · top 1,000 on PyPI
pytest-markdown-docsA pytest plugin that executes Python code…
permissive · top 15,000 on PyPI