Skip to main content

A simple plugin to first execute tests that historically failed more

Project description

============= pytest-sorter

.. image:: :target:

.. image:: :target: :alt: See Build Status on Travis CI

A simple plugin to first execute tests that historically failed more

This pytest_ plugin was generated with cookiecutter_ along with @hackebrot's cookiecutter-pytest-plugin template.


This plugin will save a history of your tests executions in a file .test_history. For each test it will have how many times it was executed, and how many times it failed.

Using that information it will calculate the percentage of failure of tests, and order them to first execute the higher failure ratio


  • Python>=3


You can install "pytest-sorter" via pip_ from PyPI_::

$ pip install pytest-sorter


After installed, your tests will automatically create and update the .test_history file, and order tests by their failure ratio.

You can tell pytest to ignore this plugin by passing:

pytest --no-sorted


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-sorter" is free and open source software


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

.. _Cookiecutter: .. _@hackebrot: .. _MIT: .. _BSD-3: .. _GNU GPL v3.0: .. _Apache Software License 2.0: .. _cookiecutter-pytest-plugin: .. _file an issue: .. _pytest: .. _tox: .. _pip: .. _PyPI:

Project details

Download files

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

Source Distribution

pytest-sorter-0.3.1.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

pytest_sorter-0.3.1-py2.py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page