pytest-twisted
A twisted plugin for pytest.
Decision gist · record as of 2026-08-14
Yes, if you are testing Twisted code. The plugin is actively maintained, has no known vulnerabilities, and low install friction. It solves a real problem—running Twisted's asynchronous code within pytest's synchronous test framework—and is the standard tool for this task. Install it if Twisted is part of your project; skip it otherwise.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Twisted to be installed separately; on Windows with Python 3.8+, asyncio reactor requires explicit selector loop configuration as documented in the package description.
- Low install friction with a pure-Python wheel distribution.
- Actively maintained with recent commits and stable status; last release was 703 days ago but the repository shows ongoing activity.
License · maintenance · safety
permissive license (permissive) — Permissive license treatment means you can use this plugin in commercial and proprietary projects without significant legal constraints.
last release 2024-09-10 (703 days) · last repo commit 2026-03-04 · 46 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 285,869 downloads/mo, #8,052 on PyPI
Alternatives
Verify before relying
pip install pytest-twisted
# In conftest.py or test file:
import pytest_twisted
from twisted.internet import defer
@pytest_twisted.inlineCallbacks
def test_deferred_operation():
result = yield defer.succeed(42)
assert result == 42- Whether Python 2.7 support remains practically tested or is maintained for compatibility only
- Current state of Windows + Python 3.8+ asyncio reactor compatibility beyond the documented workaround
What it is and what it does
pytest-twisted is a pytest plugin that bridges the gap between pytest's synchronous test model and Twisted's asynchronous Deferred-based concurrency. It automatically installs a Twisted reactor before tests run and allows test functions to return Deferred objects, which the plugin waits for rather than treating as test failures. The plugin also provides decorators and fixtures for async/await syntax, inline callbacks, and greenlet access, making it possible to write Twisted tests using pytest's standard fixture and assertion machinery.
The plugin supports multiple reactor implementations (default, asyncio, qt5reactor) and integrates with pytest's fixture system, allowing fixtures to also work with async code. It handles the complexity of reactor lifecycle management so developers can focus on testing their Twisted application logic rather than managing event loop setup and teardown.
Use it for
- Testing Twisted-based network services and protocol implementations that use Deferred callbacks
- Writing async test fixtures that need to wait for Twisted operations before providing test data
- Testing Twisted code with async/await syntax using ensureDeferred or async_fixture decorators
- Integrating Twisted application tests into a pytest-based test suite alongside synchronous tests
- Testing libraries that depend on greenlets and need access to the reactor greenlet context
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are testing Twisted code.
The plugin is actively maintained, has no known vulnerabilities, and low install friction. It solves a real problem—running Twisted's asynchronous code within pytest's synchronous test framework—and is the standard tool for this task. Install it if Twisted is part of your project; skip it otherwise.
Install
pytest-twisted on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with recent commits and stable status; last release was 703 days ago but the repository shows ongoing activity.
Requires Twisted to be installed separately; on Windows with Python 3.8+, asyncio reactor requires explicit selector loop configuration as documented in the package description.
License in practice
Permissive license treatment means you can use this plugin in commercial and proprietary projects without significant legal constraints.
Quickstart
pip install pytest-twisted
# In conftest.py or test file:
import pytest_twisted
from twisted.internet import defer
@pytest_twisted.inlineCallbacks
def test_deferred_operation():
result = yield defer.succeed(42)
assert result == 42
Verify before relying
- Whether Python 2.7 support remains practically tested or is maintained for compatibility only
- Current state of Windows + Python 3.8+ asyncio reactor compatibility beyond the documented workaround
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesgreenletpytestdecorator |
| Maintenance | Actively maintained 703 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 285,869 / month, #8,052 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: pytest_twisted-1.14.3-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest twisted testing”
- pytest-twistedA pytest plugin that enables testing of Twisted-based asynchronous…
- teamcity-messagesSends test results and build status from Python test frameworks…
- TwistedTwisted is an event-driven networking framework that provides…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also Twisted · txaio · treq · crochet · pytest-tornado · pytest-grpc · pytest-run-parallel · localstack-twisted · pytest-tornasync