Skip to main content

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

Project description

PyPI version conda-forge version Python versions See Build Status on Travis CI

A plugin to improve the readability of pytest output.


  • Enables an easier to parse and more understandable diff for your failing tests.
  • Can display unified diffs or split diffs, and chooses them depending on the context.
  • Adds helpful hints to the output for failing tests to help you track down common issues.

With pytest-clarity:

Example output with clarity

The same test, without pytest-clarity:

Example output without clarity


Supports Python 2.7 and 3.4+


You can install “pytest-clarity” via pip from PyPI:

$ pip install pytest-clarity


Install the plugin as described above, and it will be automatically enabled.

You can choose which type of diff you want with --diff-type (auto (default), split or unified):

pytest --diff-type=split

You can disable hints using the --no-hints flag:

pytest --no-hints

You can configure the width of the output with the --diff-width option:

pytest --diff-width=60


Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.


Distributed under the terms of the MIT license, “pytest-clarity” is free and open source software.


If you encounter any problems, please file an issue along with a detailed description.

This pytest plugin was generated with Cookiecutter along with @hackebrot’s cookiecutter-pytest-plugin template.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-clarity, version 0.2.0a1
Filename, size File type Python version Upload date Hashes
Filename, size pytest-clarity-0.2.0a1.tar.gz (6.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page