skillfed

pytest-clarity

A plugin providing an alternative, colourful diff output for failing assertions.

pytest-clarity v1.0.1 651.0K downloads/30d#5,554 on PyPI455
Permissive license MIT DORMANT released

What it is and what it does

pytest-clarity is a pytest plugin that enhances test failure output by replacing the default assertion diff with a colored, side-by-side comparison format inspired by the Ward test framework. When you run pytest with the `-vv` flag, the plugin intercepts failing assertions and renders them with visual highlighting to make differences between expected and actual values easier to spot at a glance.

The plugin requires no runtime dependencies and integrates directly into pytest's output pipeline. It offers two configuration options: `--diff-width` to control the width of the diff display, and `--diff-symbols` to force a symbolic representation instead of colored text. However, the package has been dormant since mid-2021, with no recent commits or releases, so compatibility with very recent pytest or Python versions may not be guaranteed.

Use it for:

  • Debugging complex assertion failures in test suites where the default pytest diff is hard to read quickly.
  • Making test output more readable in CI/CD logs where colored diffs help identify mismatches faster.
  • Improving developer experience during local test runs by visually highlighting differences in string, dict, or list comparisons.
  • Reducing time spent parsing assertion errors in large test suites with many failing tests.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that displays colored, side-by-side diffs for failing test assertions, activated with the `-vv` flag and configurable via command-line options.

Yes, if you are running pytest on Python 3.6–3.9 and want better visual assertion diffs. The plugin is lightweight, has no dependencies, and is widely downloaded. However, dormancy since 2021 means it may not work with newer pytest or Python versions—verify compatibility with your environment first. If you're on a recent Python or pytest version, test it in a non-critical environment before relying on it.

Install

pytest-clarity on PyPI

pip

pip install pytest-clarity

uv

uv add pytest-clarity

poetry

poetry add pytest-clarity

Installing pytest-clarity

Before you install

High install friction: the package is dormant (last release 2021-06-11, last commit 2024-02-18) with no runtime dependencies, but the source distribution requires extraction and installation. Maintenance status suggests it may not receive updates for compatibility with newer pytest or Python versions.

License in practice

MIT license (permissive) means you can use, modify, and distribute the package freely with minimal restrictions, provided you include the license notice.

Quickstart

pip install pytest-clarity

Then run pytest with the -vv flag:

pytest -vv --diff-width=60

Requires Python 2.7 or 3.6+ (supports 3.6, 3.7, 3.8, 3.9). The plugin only activates when pytest is run with the -vv option.

Verify before relying

  • Compatibility with pytest versions released after the package's last update (2021-06-11) is unclear.
  • Whether the colored diff output works correctly with modern terminal emulators and CI/CD environments.
  • Performance impact on large test suites with many failing assertions.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*)
Install friction high — source build required
Runtime dependencies none
Maintenance dormant — 1,890 days since the last release
Last repo commit
First released
Downloads 650,999/month — #5,554 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest-clarity-1.0.1.tar.gz

Framework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Testing

Tags

pytest colored diff outputpytest assertion diff displaypytest test failure visualizationpytest colored test outputpytest diff formatting pluginpytest assertion comparisonpytest test diff colors
pytest-plugintest-outputdiff-visualization

More Testing packages