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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 34.8MB
glibcpy 3.10–3.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.fixSet 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.fixAdd `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.fixAlways 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.