pytest-reverse


Namepytest-reverse JSON
Version 1.8.0 PyPI version JSON
download
home_pageNone
SummaryPytest plugin to reverse test order.
upload_time2024-10-25 15:23:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords pytest reverse
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==============
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-commit

Pytest plugin to reverse test order.

----

**Testing a Django project?**
Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ 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 <https://docs.pytest.org/en/latest/customize.html#adding-default-options>`__):

.. code-block:: ini

    [pytest]
    addopts = --reverse

History
=======

I'm the creator and maintainer of
`pytest-randomly <https://github.com/pytest-dev/pytest-randomly>`__, a plugin
for randomly ordering tests. @thbde opened an issue there pointing to the paper
`Empirically revisiting the test independence
assumption <https://dl.acm.org/doi/10.1145/2610384.2610404>`__, 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 <https://docs.djangoproject.com/en/dev/ref/django-admin/#cmdoption-test-reverse>`__.
I figured such an option or plugin would exist for pytest already, but it
didn't, so I made it here.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytest-reverse",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pytest, reverse",
    "author": null,
    "author_email": "Adam Johnson <me@adamj.eu>",
    "download_url": "https://files.pythonhosted.org/packages/a3/5d/f1177a7ee9d104ec9f3067fc15ee21ce4b71b6d23ba827a08f4c51c39b30/pytest_reverse-1.8.0.tar.gz",
    "platform": null,
    "description": "==============\npytest-reverse\n==============\n\n.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/pytest-reverse/main.yml.svg?branch=main&style=for-the-badge\n   :target: https://github.com/adamchainz/pytest-reverse/actions?workflow=CI\n\n.. image:: https://img.shields.io/pypi/v/pytest-reverse.svg?style=for-the-badge\n   :target: https://pypi.org/project/pytest-reverse/\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge\n   :target: https://github.com/psf/black\n\n.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge\n   :target: https://github.com/pre-commit/pre-commit\n   :alt: pre-commit\n\nPytest plugin to reverse test order.\n\n----\n\n**Testing a Django project?**\nCheck out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.\nI created pytest-reverse whilst working on the book!\n\n----\n\nInstallation\n============\n\nInstall with:\n\n.. code-block:: bash\n\n    python -m pip install pytest-reverse\n\nPython 3.9 to 3.13 supported.\n\nUsage\n=====\n\nPytest will automatically find the plugin and use it when you run ``pytest``.\nYou can reverse test order by passing the ``--reverse`` flag:\n\n.. code-block:: bash\n\n    pytest --reverse\n\nYou can make this always apply by adding it to the ``addopts`` setting in your\n``pytest.ini`` (or `other configuration\nfile <https://docs.pytest.org/en/latest/customize.html#adding-default-options>`__):\n\n.. code-block:: ini\n\n    [pytest]\n    addopts = --reverse\n\nHistory\n=======\n\nI'm the creator and maintainer of\n`pytest-randomly <https://github.com/pytest-dev/pytest-randomly>`__, a plugin\nfor randomly ordering tests. @thbde opened an issue there pointing to the paper\n`Empirically revisiting the test independence\nassumption <https://dl.acm.org/doi/10.1145/2610384.2610404>`__, which covers\ntest reordering techniques. It turns out that reversal is nearly as effective\nas randomization.\n\nTest reversal is available `in Django's test\nrunner <https://docs.djangoproject.com/en/dev/ref/django-admin/#cmdoption-test-reverse>`__.\nI figured such an option or plugin would exist for pytest already, but it\ndidn't, so I made it here.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Pytest plugin to reverse test order.",
    "version": "1.8.0",
    "project_urls": {
        "Changelog": "https://github.com/adamchainz/pytest-reverse/blob/main/CHANGELOG.rst",
        "Funding": "https://adamj.eu/books/",
        "Repository": "https://github.com/adamchainz/pytest-reverse"
    },
    "split_keywords": [
        "pytest",
        " reverse"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53e2efa8261ea453103b8360d1313ca6578e3cdff2c76c9edd1ea99827175426",
                "md5": "0b81558ffdce0fdce340230cd9163ae1",
                "sha256": "e31a2d0b51f2f8b6162aed268f853851f55c62ac445041a032740e985b0bc8c8"
            },
            "downloads": -1,
            "filename": "pytest_reverse-1.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b81558ffdce0fdce340230cd9163ae1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4119,
            "upload_time": "2024-10-25T15:23:03",
            "upload_time_iso_8601": "2024-10-25T15:23:03.175282Z",
            "url": "https://files.pythonhosted.org/packages/53/e2/efa8261ea453103b8360d1313ca6578e3cdff2c76c9edd1ea99827175426/pytest_reverse-1.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a35df1177a7ee9d104ec9f3067fc15ee21ce4b71b6d23ba827a08f4c51c39b30",
                "md5": "6c36b0cead5ffe5ac0acd1eacb94738a",
                "sha256": "eb72ffd57cc91061e837b1d2c4522bfda58eaa83fc97147fd90f7929160e97ab"
            },
            "downloads": -1,
            "filename": "pytest_reverse-1.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6c36b0cead5ffe5ac0acd1eacb94738a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 4438,
            "upload_time": "2024-10-25T15:23:04",
            "upload_time_iso_8601": "2024-10-25T15:23:04.776406Z",
            "url": "https://files.pythonhosted.org/packages/a3/5d/f1177a7ee9d104ec9f3067fc15ee21ce4b71b6d23ba827a08f4c51c39b30/pytest_reverse-1.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-25 15:23:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "adamchainz",
    "github_project": "pytest-reverse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pytest-reverse"
}
        
Elapsed time: 1.21850s