Skip to main content

Pytest plugin to reverse test order.

Project description

https://img.shields.io/github/actions/workflow/status/adamchainz/pytest-reverse/main.yml?branch=main&style=for-the-badge https://img.shields.io/pypi/v/pytest-reverse.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

Pytest plugin to reverse test order.

Installation

Install with:

python -m pip install pytest-reverse

Python 3.8 to 3.12 supported.


Testing a Django project? Check out my book Speed Up Your Django Tests which covers loads of recommendations to write faster, more accurate tests. I created pytest-reverse whilst working on the book!


Usage

Pytest will automatically find the plugin and use it when you run pytest. You can reverse test order by passing the --reverse flag:

pytest --reverse

You can make this always apply by adding it to the addopts setting in your pytest.ini (or other configuration file):

[pytest]
addopts = --reverse

History

I’m the creator and maintainer of pytest-randomly, a plugin for randomly ordering tests. @thbde opened an issue there pointing to the paper Empirically revisiting the test independence assumption, which covers test reordering techniques. It turns out that reversal is nearly as effective as randomization.

Test reversal is available in Django’s test runner. I figured such an option or plugin would exist for pytest already, but it didn’t, so I made it here.

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_reverse-1.7.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_reverse-1.7.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_reverse-1.7.0.tar.gz.

File metadata

  • Download URL: pytest_reverse-1.7.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pytest_reverse-1.7.0.tar.gz
Algorithm Hash digest
SHA256 f943e5b9d253267569fd7ad237afc56b3e98ce9f6d2f6f3bb487b8c759e214fe
MD5 1f3ff2dcee1ae9f69e5a9a8d69283a23
BLAKE2b-256 b99c1d0988d202954f3b84b812c0456945029a24d76066c4d5c182b0dfe1090a

See more details on using hashes here.

File details

Details for the file pytest_reverse-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_reverse-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pytest_reverse-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37e83daac57eea3fb1cb718aa9ccdf9ca2ea8ac3645cb5bccf1c7ae25a8ad1d2
MD5 735fcd5c99f6ae2e2e1c60a8c46ddfe3
BLAKE2b-256 0ad5bd87faf152c7beb98cc63ac73437ddad9ecb46a6b0f1a0ed70fff13f2d23

See more details on using hashes here.

Supported by

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