pytest-reverse


Namepytest-reverse JSON
Version 1.7.0 PyPI version JSON
download
home_pagehttps://github.com/adamchainz/pytest-reverse
SummaryPytest plugin to reverse test order.
upload_time2023-07-10 15:18:15
maintainer
docs_urlNone
authorAdam Johnson
requires_python>=3.8
licenseMIT
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?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.

Installation
============

Install with:

.. code-block:: bash

    python -m pip install pytest-reverse

Python 3.8 to 3.12 supported.

----

**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!

----

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": "https://github.com/adamchainz/pytest-reverse",
    "name": "pytest-reverse",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pytest,reverse",
    "author": "Adam Johnson",
    "author_email": "me@adamj.eu",
    "download_url": "https://files.pythonhosted.org/packages/b9/9c/1d0988d202954f3b84b812c0456945029a24d76066c4d5c182b0dfe1090a/pytest_reverse-1.7.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?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\nInstallation\n============\n\nInstall with:\n\n.. code-block:: bash\n\n    python -m pip install pytest-reverse\n\nPython 3.8 to 3.12 supported.\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\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": "MIT",
    "summary": "Pytest plugin to reverse test order.",
    "version": "1.7.0",
    "project_urls": {
        "Changelog": "https://github.com/adamchainz/pytest-reverse/blob/main/CHANGELOG.rst",
        "Homepage": "https://github.com/adamchainz/pytest-reverse",
        "Mastodon": "https://fosstodon.org/@adamchainz",
        "Twitter": "https://twitter.com/adamchainz"
    },
    "split_keywords": [
        "pytest",
        "reverse"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ad5bd87faf152c7beb98cc63ac73437ddad9ecb46a6b0f1a0ed70fff13f2d23",
                "md5": "735fcd5c99f6ae2e2e1c60a8c46ddfe3",
                "sha256": "37e83daac57eea3fb1cb718aa9ccdf9ca2ea8ac3645cb5bccf1c7ae25a8ad1d2"
            },
            "downloads": -1,
            "filename": "pytest_reverse-1.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "735fcd5c99f6ae2e2e1c60a8c46ddfe3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4178,
            "upload_time": "2023-07-10T15:18:13",
            "upload_time_iso_8601": "2023-07-10T15:18:13.840916Z",
            "url": "https://files.pythonhosted.org/packages/0a/d5/bd87faf152c7beb98cc63ac73437ddad9ecb46a6b0f1a0ed70fff13f2d23/pytest_reverse-1.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b99c1d0988d202954f3b84b812c0456945029a24d76066c4d5c182b0dfe1090a",
                "md5": "1f3ff2dcee1ae9f69e5a9a8d69283a23",
                "sha256": "f943e5b9d253267569fd7ad237afc56b3e98ce9f6d2f6f3bb487b8c759e214fe"
            },
            "downloads": -1,
            "filename": "pytest_reverse-1.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1f3ff2dcee1ae9f69e5a9a8d69283a23",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4622,
            "upload_time": "2023-07-10T15:18:15",
            "upload_time_iso_8601": "2023-07-10T15:18:15.110106Z",
            "url": "https://files.pythonhosted.org/packages/b9/9c/1d0988d202954f3b84b812c0456945029a24d76066c4d5c182b0dfe1090a/pytest_reverse-1.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 15:18:15",
    "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: 0.08684s