Registry / testing / pytest-pretty

pytest-pretty

JSON →
library1.3.0pypypi✓ verified 25d ago

pytest-pretty is an opinionated pytest plugin designed to enhance the readability of test output and simplify the process of identifying and resolving errors. It provides features such as a real-time error summary, a rich, tabulated display of failures, and a more visually appealing overall summary of the test run. The current version is 1.3.0, and while its release cadence is irregular, the project is actively maintained.

pip install -U pytest-pretty
INSTALL
IMPORT
SIG · PYTEST-PRETTY
P
pytest-pretty
testingpythonv1.3.0
Install
3.1s avg
Import
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 34.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.1s · import 0.000s · 35MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest-pretty (plugin)
No explicit import usually needed, automatically activated by pytest.
As a pytest plugin, pytest-pretty automatically integrates upon installation. Direct imports are typically not required for its core functionality.
pytester_pretty (fixture)
from pytest_pretty import pytester_pretty
While pytest_pretty provides a pytester_pretty fixture, it is typically made available by setting pytest_plugins = "pytester" in conftest.py, allowing it to be used directly in tests without explicit import statements in test files.

After installing `pytest-pretty`, simply run `pytest` from your terminal in a directory containing your test files (e.g., `test_example.py`). The plugin will automatically enhance the test summary, error reporting, and overall output. For optimal display in CI/CD environments like GitHub Actions, it's recommended to set the `COLUMNS` environment variable to a sufficient width.

# test_example.py def test_passing_example(): assert 1 + 1 == 2 def test_failing_example(): # This assertion will fail to demonstrate the pretty failure output assert {"a": 1, "b": 2} == {"a": 1, "b": 3} # To run the tests, navigate to the directory containing test_example.py # and run the following command in your terminal: # pytest # For GitHub Actions, consider adding: # env: # COLUMNS: 120 # to your workflow .yml file for better output formatting.
pytest --version
Debug
Known issues
gotchaWhen running pytest-pretty in CI/CD environments such as GitHub Actions, the default terminal width might truncate the rich output. This can make the enhanced summary tables and error details less readable.
fix
Set the `COLUMNS` environment variable in your CI/CD workflow file to a larger value (e.g., `COLUMNS: 120`) to ensure the output is displayed fully.
affects: All versions
gotchaIf you intend to use the `pytester_pretty` fixture (which replaces pytest's built-in `pytester` for interacting with `pytest-pretty`'s modified output), you must explicitly enable the `pytester` plugin.
fix
Add `pytest_plugins = "pytester"` to your `conftest.py` file to make the `pytester_pretty` fixture available to your tests.
affects: All versions
breakingAs a pytest plugin, `pytest-pretty`'s compatibility and behavior can be indirectly affected by breaking changes in the core `pytest` framework, particularly with major `pytest` version upgrades.
fix
Always consult the `pytest` changelog (e.g., for `pytest 8.0.0` and subsequent versions) for breaking changes, especially concerning test collection, hooks, and plugin APIs. Test your suite thoroughly after upgrading `pytest`.
affects: All versions of pytest-pretty when used with major pytest updates (e.g., pytest 8.x and later).
Upgrade
Version history
1.3.0latest on PyPI · released Jun 4, 2025
Audit
Dependencies
pytestrequiredCore testing framework, pytest-pretty is a plugin for it.
richrequiredUsed for rich console formatting and pretty printing.
Agent activity
10 hits · last 30 days
node
8
Resources
pytest-pretty — pip install pytest-pretty · libregistry