Skip to main content

Pytest plugin to reverse test order.

Project description

https://img.shields.io/github/workflow/status/adamchainz/pytest-reverse/CI/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.7 to 3.10 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.4.0.tar.gz (4.7 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.4.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-reverse-1.4.0.tar.gz.

File metadata

  • Download URL: pytest-reverse-1.4.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pytest-reverse-1.4.0.tar.gz
Algorithm Hash digest
SHA256 1695b7c9e51b28db5af13d579b33b54a80958d86b886dfabd2a246bcad3e082e
MD5 06cbcd164a9ed131ea930cd80c6bb106
BLAKE2b-256 6913db791fabab138c7d81b9e3bf0233c69cbb6e3964170f87249b99df479aa1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_reverse-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pytest_reverse-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6acfb50acd11caf3d222366f5e1458dea2351d47b6ca5b08ab408158636250ba
MD5 fb5bcf44dc0889a7ee333497a9ff57e1
BLAKE2b-256 efd723302d2eef2585050b4241e1e8e6febd6e8a3415ee10716d0befcbf7e393

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