pytest-pretty

An opinionated pytest plugin that makes test output easier to read and failures faster to find and fix.

Tool
PyPI
v1.3.0
474stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
39/100Needs Attention
Development Activity0
Maintenance20
Community44
Maturity52
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture72
Code Quality78
Innovation70
Learning Curve95

pytest-pretty is a small, opinionated pytest plugin from Samuel Colvin (creator of Pydantic) that restyles pytest’s terminal output so results are easier to scan and failures are easier to act on. Its only dependencies are pytest itself and rich.

It adds a realtime one-line error summary as tests run, a rich table of failures that lists both the test location and the error line number, and a prettier end-of-run summary that includes the total time taken. Together these make it far quicker to jump straight to a broken test instead of scrolling through a wall of output.

What You Get

  • A realtime one-line error summary showing which test failed while the suite is still running
  • A rich table of failures listing test location and error line number for fast navigation
  • A prettier end-of-run summary that reports total time taken
  • A drop-in pytester_pretty fixture for testing plugins against the modified output
  • Zero-config activation as a pytest plugin with only pytest and rich as dependencies

Common Use Cases

  • Making local test runs easier to read while iterating on a large suite
  • Quickly locating and jumping to failing tests without scrolling through full output
  • Improving the readability of pytest output in CI logs such as GitHub Actions
  • Standardizing test-output formatting across a team’s projects

Under The Hood

Architecture - pytest-pretty is a single-module plugin (pytest_pretty/init.py) that registers via the pytest11 entry point. It subclasses pytest’s TerminalReporter as CustomTerminalReporter, overriding pytest_runtest_logreport to emit realtime failure lines and hooking pytest_sessionstart/pytest_sessionfinish to time the run. A rich Console and Table render the final failure summary with file, line, and error-line references.

Tech Stack - Pure Python (>=3.9), built with hatchling. Its runtime dependencies are just pytest>=7 and rich>=12. Development uses ruff for linting and formatting, and uv for locking. It ships as a pytest plugin with no CLI of its own.

Code Quality - The codebase is compact and idiomatic, using from future import annotations, typed signatures, and TYPE_CHECKING guards. It includes a tests directory (test_simple.py) exercised against pytest’s own pytester, plus strict pytest config (filterwarnings = error, xfail_strict) and branch coverage settings.

API Design - There is effectively no API surface to learn: installing the package activates it automatically. The only public affordance is the pytester_pretty fixture for plugin authors, making adoption essentially zero-config.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search