pytest-reportlog
Replacement for the --resultlog option, focused in simplicity and extensibility
What it is and what it does
pytest-reportlog is a pytest plugin that captures test execution events and writes them as JSON Lines to a file, one self-contained JSON object per line. It was created as a modern replacement for pytest's deprecated --resultlog option, focusing on simplicity and extensibility. Each line contains a report object with a $report_type identifier (e.g., SessionStart, TestReport, SessionFinish) plus event-specific fields like outcome, duration, and failure details. The file is flushed after each write, enabling real-time consumption by external systems.
The plugin supports automatic compression via common suffixes (.gz, .bz2, .xz) and includes a record_property fixture for attaching custom metadata to individual tests. It runs as a pytest plugin with no special configuration beyond installing the package and passing --report-log=FILE to pytest. The output format is designed for forward compatibility: consumers should ignore unrecognized report types and unknown keys, as future pytest versions may extend the objects.
Use it for:
- Export test results to a structured format for CI/CD pipelines to parse and aggregate across multiple test runs.
- Stream test events in real-time to a monitoring system or dashboard during long test sessions.
- Attach custom properties (price, environment, build ID) to individual tests for post-analysis and reporting.
- Archive test execution history in compressed JSON Lines format for audit trails or compliance.
- Integrate pytest results with external tools that consume JSON events without needing custom pytest plugins.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Writes pytest test results to a JSON Lines file in real-time, replacing the deprecated --resultlog option with a simpler, extensible format.
Yes. This is a stable, actively maintained plugin with low install friction, no security issues, and a clear use case: anyone migrating from --resultlog or needing structured, real-time test event logging should use it. The MIT license and minimal dependencies make it safe for any project.
Install
pytest-reportlog on PyPI
pip
pip install pytest-reportloguv
uv add pytest-reportlogpoetry
poetry add pytest-reportlogInstalling pytest-reportlog
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with a recent release and no known vulnerabilities.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects.
Quickstart
pip install pytest-reportlog
pytest your_tests.py --report-log=results.jsonl
# Read the JSON Lines output
import json
with open('results.jsonl') as f:
for line in f:
event = json.loads(line)
print(event['$report_type'], event.get('outcome'))
Requires Python 3.10 or later.
Verify before relying
- Whether compression formats (.gz, .bz2, .xz) require additional system libraries beyond Python stdlib.
- Real-time event processing guarantees and performance characteristics with large test suites.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | actively maintained — 276 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 801,875/month — #5,021 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_reportlog-1.0.0-py3-none-any.whl
Keywords: pytest
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
pytest-csvA pytest plugin that exports test results to…
copyleft · top 15,000 on PyPI
pytest-json-reportA pytest plugin that generates JSON-formatted…
permissive · top 5,000 on PyPI
pytest-tinybirdA pytest plugin that automatically posts test…
permissive · top 15,000 on PyPI
pytest-reporterA pytest plugin that generates customizable…
permissive · top 15,000 on PyPI
pytest-replayA pytest plugin that records test execution…
permissive · top 15,000 on PyPI
pytest-md-reportA pytest plugin that generates test outcome…
permissive · top 15,000 on PyPI
pytest-rerunfailuresA pytest plugin that automatically reruns…
copyleft · top 1,000 on PyPI
pytest-prettyA pytest plugin that formats test output with…
permissive · top 5,000 on PyPI
jsonformatterFormats Python logging output as JSON, enabling…
permissive · top 15,000 on PyPI