Pytest plugin to reverse test order.
Project description
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.13 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest_reverse-1.8.0.tar.gz
.
File metadata
- Download URL: pytest_reverse-1.8.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb72ffd57cc91061e837b1d2c4522bfda58eaa83fc97147fd90f7929160e97ab |
|
MD5 | 6c36b0cead5ffe5ac0acd1eacb94738a |
|
BLAKE2b-256 | a35df1177a7ee9d104ec9f3067fc15ee21ce4b71b6d23ba827a08f4c51c39b30 |
File details
Details for the file pytest_reverse-1.8.0-py3-none-any.whl
.
File metadata
- Download URL: pytest_reverse-1.8.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e31a2d0b51f2f8b6162aed268f853851f55c62ac445041a032740e985b0bc8c8 |
|
MD5 | 0b81558ffdce0fdce340230cd9163ae1 |
|
BLAKE2b-256 | 53e2efa8261ea453103b8360d1313ca6578e3cdff2c76c9edd1ea99827175426 |