Pytest plugin to reverse test order.
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!
Installation
Install with:
python -m pip install pytest-reverse
Python 3.9 to 3.14 supported.
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.
Metadata
Release files for pytest-reverse 1.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_reverse-1.9.0.tar.gz | 4.7 kB | With provenance | Details for pytest_reverse-1.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_reverse-1.9.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_reverse-1.9.0-py3-none-any.whl |
Total release size: 8.9 kB
Release files / pytest_reverse-1.9.0.tar.gz
| Download URL | pytest_reverse-1.9.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3b756f13bfc5b9aa39bfc57d2d5e03ec62f7fdfed2c04cad664c283d63ce94a
|
|
BLAKE2b-256 checksum How to use checksums |
d05f9f3227f0c1ae1411fa5921af8f9cb88ac71f988750ab0bc27f4a29179a64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency logRelease files / pytest_reverse-1.9.0-py3-none-any.whl
| Download URL | pytest_reverse-1.9.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3cb9cb2403eea2f953fd6b9629637387cf6e75594f8573738f68ec1aca11dcd1
|
|
BLAKE2b-256 checksum How to use checksums |
291c126e8d934e8852c89fb898f77512050c0c34cf96f195f02cbd36c5dd0356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency logSecurity for pytest-reverse 1.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pytest_reverse-1.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.