python-subunit
Python implementation of subunit test streaming protocol
What it is and what it does
Subunit is a Python implementation of a streaming protocol for test results designed to handle distributed, parallel, and cross-language test execution. It models xUnit-style test outcomes (start, pass/fail, finish) and extends them with test enumeration, tagging, file attachments, and timestamps. The protocol comes in two versions: Version 1 (human-readable but with buffering and corruption issues in parallel scenarios) and Version 2 (binary, packet-based, designed for multiplexing without excessive buffering and with recovery mechanisms for corrupted streams).
The package provides Python bindings to emit and consume subunit streams, making it useful for aggregating test results from separate processes, languages, or machines into a single unified stream. It includes filters and tools to convert between subunit and other formats (CSV, JUnit XML, TAP), and integrates with Python's unittest framework via the subunit.run module. Dependencies on iso8601, PyYAML, and testtools keep the core lightweight while supporting timestamp parsing, configuration, and test result modeling.
Use it for:
- Aggregate test results from multiple test runners or languages into a single stream for centralized reporting.
- Run isolated test suites in separate processes and combine their results without interference using subunit's multiplexing.
- Archive and replay test runs by recording subunit streams and replaying them later for analysis or debugging.
- Distribute test execution across multiple machines and collect results in real time via a subunit stream.
- Convert test results between formats (e.g., TAP to subunit, subunit to JUnit XML) using the protocol's filters.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Subunit is a streaming protocol library for test results that aggregates, serializes, and multiplexes test execution across languages and machines into a unified stream.
Yes. Subunit is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. Install it if you need to aggregate, multiplex, or serialize test results across distributed or parallel test runs, or if you're integrating tests from multiple languages or frameworks. Skip it if your testing stays within a single process or framework without cross-language aggregation needs.
Install
python-subunit on PyPI
pip
pip install python-subunituv
uv add python-subunitpoetry
poetry add python-subunitInstalling python-subunit
Before you install
Low friction install with a pure-Python wheel. Active maintenance with recent commits and support for current Python versions (3.10–3.14). Three lightweight runtime dependencies (iso8601, PyYAML, testtools) are all stable, widely-used libraries.
License in practice
Dual-licensed under Apache-2.0 or BSD (user's choice), both permissive licenses with no copyleft obligations. You may use, modify, and distribute freely under either license terms.
Quickstart
pip install python-subunit
import subunit
from subunit import StreamResultToDict
# Parse a subunit stream
result_dict = StreamResultToDict()
# Feed stream data to result_dict and extract test results
Requires Python 3.10 or later; depends on iso8601, PyYAML, and testtools at runtime.
Verify before relying
- Whether the package includes command-line filters (tap2subunit, subunit2csv, etc.) mentioned in the description or if those are separate tools.
- Whether GTK and JUnit XML conversion features are available in the Python bindings or require additional setup.
- Current state of protocol version 2 implementation and stability relative to version 1.
Package facts
| License | Apache-2.0 or BSD (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — iso8601, PyYAML, testtools |
| Maintenance | actively maintained — 102 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,282,582/month — #4,115 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_subunit-1.4.6-py3-none-any.whl
Keywords: python, streaming, test
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
os-testros-testr wraps the testr test runner to provide…
permissive · top 15,000 on PyPI
stestrstestr is a parallel test runner for Python…
permissive · top 15,000 on PyPI
unittest-xml-reportingA unittest test runner that exports test…
permissive · top 5,000 on PyPI
base64ioProvides a streaming interface for Base64…
permissive · top 15,000 on PyPI
xunitparserParses JUnit/XUnit XML test result files and…
permissive · top 15,000 on PyPI
junit2htmlConverts JUnit or XUnit XML test result files…
permissive · top 5,000 on PyPI
junit-xml-2Generates JUnit XML test result reports from…
permissive · top 15,000 on PyPI
concurrencytestRuns unittest test suites concurrently across…
copyleft · top 15,000 on PyPI
junitparserParse, create, and manipulate JUnit/xUnit test…
permissive · top 5,000 on PyPI
xmlrunnerA unittest test runner that exports test…
copyleft · top 15,000 on PyPI