skillfed

pytest-reportlog

Replacement for the --resultlog option, focused in simplicity and extensibility

pytest-reportlog v1.0.0 801.9K downloads/30d#5,021 on PyPI104
Permissive license MIT Active released

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-reportlog

uv

uv add pytest-reportlog

poetry

poetry add pytest-reportlog

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Testing

Tags

pytest json outputtest results loggingpytest report generationjson lines test reportingpytest result exporttest session loggingpytest event streaming
pytest-pluginjson-outputtest-reporting

More Testing packages