Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamchainz/pytest-reverse
Pytest plugin to reverse test order.
https://github.com/adamchainz/pytest-reverse
pytest
Last synced: 27 days ago
JSON representation
Pytest plugin to reverse test order.
- Host: GitHub
- URL: https://github.com/adamchainz/pytest-reverse
- Owner: adamchainz
- License: mit
- Created: 2020-04-03T19:03:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T21:02:47.000Z (8 months ago)
- Last Synced: 2024-05-01T12:54:18.022Z (8 months ago)
- Topics: pytest
- Language: Python
- Homepage:
- Size: 337 KB
- Stars: 22
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
- awesome-pytest - pytest-reverse - Pytest plugin to reverse test order. (Plugins)
README
==============
pytest-reverse
==============.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/pytest-reverse/main.yml.svg?branch=main&style=for-the-badge
:target: https://github.com/adamchainz/pytest-reverse/actions?workflow=CI.. image:: https://img.shields.io/pypi/v/pytest-reverse.svg?style=for-the-badge
:target: https://pypi.org/project/pytest-reverse/.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge
:target: https://github.com/psf/black.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commitPytest 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:
.. code-block:: bash
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:.. code-block:: bash
pytest --reverse
You can make this always apply by adding it to the ``addopts`` setting in your
``pytest.ini`` (or `other configuration
file `__):.. code-block:: ini
[pytest]
addopts = --reverseHistory
=======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.