Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A simple plugin to first execute tests that historically failed more

Project Description


.. image::

.. image::
: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`:

Release History

This version
History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(6.0 kB) Copy SHA256 Hash SHA256
Wheel py3 Oct 6, 2017
(4.6 kB) Copy SHA256 Hash SHA256
Source None Oct 6, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers