pytest-order


Namepytest-order JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/pytest-dev/pytest-order
Summarypytest plugin to run your tests in a specific order
upload_time2024-08-22 12:29:54
maintainerNone
docs_urlNone
authormrbean-bremen
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            _pytest-order_ - a pytest plugin to order test execution
========================================================

[![PyPI version](https://badge.fury.io/py/pytest-order.svg)](https://pypi.org/project/pytest-order) [![Testsuite](https://github.com/pytest-dev/pytest-order/workflows/Testsuite/badge.svg)](https://github.com/pytest-dev/pytest-order/actions?query=workflow%3ATestsuite) [![DocBuild](https://readthedocs.org/projects/pytest-order/badge/?version=latest)](https://pytest-order.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/pytest-dev/pytest-order/branch/main/graph/badge.svg?token=M9PHWZSHUU)](https://codecov.io/gh/pytest-dev/pytest-order) [![Python version](https://img.shields.io/pypi/pyversions/pytest-order.svg)](https://pypi.org/project/pytest-order)

`pytest-order` is a pytest plugin that allows you to customize the order in which
your tests are run. It uses the marker `order` that defines when a specific
test shall run, either by using an ordinal number, or by specifying the
relationship to other tests.

`pytest-order` is a fork of
[pytest-ordering](https://github.com/ftobia/pytest-ordering) that provides
additional features like ordering relative to other tests.

`pytest-order` works with Python 3.7 - 3.12, with pytest
versions >= 5.0.0 for all versions up to Python 3.9, and for pytest >=
6.2.4 for Python >= 3.10. `pytest-order` runs on Linux, macOS and Windows.

Documentation
-------------
Apart from this overview, the following information is available:
- usage documentation for the [latest release](https://pytest-order.readthedocs.io/en/stable/)
- usage documentation for the [current main branch](https://pytest-order.readthedocs.io/en/latest/)
- most examples shown in the documentation can also be found in the
  [repository](https://github.com/pytest-dev/pytest-order/tree/main/example)
- the [Release Notes](https://github.com/pytest-dev/pytest-order/blob/main/CHANGELOG.md)
  with a list of changes in the latest versions
- a [list of open issues](https://github.com/pytest-dev/pytest-order/blob/main/old_issues.md)
  in the original project and their handling in `pytest-order`

Features
--------
`pytest-order` provides the following features:
- ordering of tests [by index](https://pytest-order.readthedocs.io/en/stable/usage.html#ordering-by-numbers)
- ordering of tests both from the start and from the end (via negative
  index)
- ordering of tests [relative to each other](https://pytest-order.readthedocs.io/en/stable/usage.html#order-relative-to-other-tests)
  (via the `before` and `after` marker attributes)
- session-, module- and class-scope ordering via the
  [order-scope](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-scope) option
- directory scope ordering via the
  [order-scope-level](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-scope-level) option
- hierarchical module and class-level ordering via the
  [order-group-scope](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-group-scope) option
- ordering tests with `pytest-dependency` markers if using the
  [order-dependencies](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-dependencies) option,
  more information about `pytest-dependency` compatibility
  [here](https://pytest-order.readthedocs.io/en/stable/other_plugins.html#relationship-with-pytest-dependency)
- sparse ordering of tests via the
  [sparse-ordering](https://pytest-order.readthedocs.io/en/stable/configuration.html#sparse-ordering) option
- usage of custom markers for ordering using the
  [order-marker-prefix](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-marker-prefix) option

Overview
--------
_(adapted from the original project)_

Have you ever wanted to easily run one of your tests before any others run?
Or run some tests last? Or run this one test before that other test? Or
make sure that this group of tests runs after this other group of tests?

Now you can.

Install with:

    pip install pytest-order

This defines the ``order`` marker that you can use in your code with
different attributes.

For example, this code:

    import pytest

    @pytest.mark.order(2)
    def test_foo():
        assert True

    @pytest.mark.order(1)
    def test_bar():
        assert True

yields the output:

    $ pytest test_foo.py -vv
    ============================= test session starts ==============================
    platform darwin -- Python 3.7.1, pytest-5.4.3, py-1.8.1, pluggy-0.13.1 -- env/bin/python
    plugins: order
    collected 2 items

    test_foo.py:7: test_bar PASSED
    test_foo.py:3: test_foo PASSED

    =========================== 2 passed in 0.01 seconds ===========================

Contributing
------------
Contributions are very welcome. Tests can be run with
[tox](https://tox.readthedocs.io/en/latest/), please ensure
the coverage at least stays the same before you submit a pull request.

License
-------
Distributed under the terms of the [MIT](http://opensource.org/licenses/MIT)
license, `pytest-order` is free and open source software.

History
-------
This is a fork of [pytest-ordering](https://github.com/ftobia/pytest-ordering).
That project is not maintained anymore, and there are several helpful PRs
that are now integrated into `pytest-order`. The idea and most of the
initial code has been created by Frank Tobia, the author of that plugin, and
[contributors](https://github.com/pytest-dev/pytest-order/blob/main/AUTHORS).

While derived from `pytest_ordering`, `pytest-order` is **not** compatible
with `pytest-ordering` due to the changed marker name (`order` instead of
`run`). Additional markers defined in `pytest_ordering` are all integrated
into the `order` marker (for a rationale see also
[this issue](https://github.com/ftobia/pytest-ordering/issues/38)).

Ordering relative to other tests and all the configuration options are not
available in the released version of `pytest-ordering`.
However, most of these features are derived from or inspired by
[issues](https://github.com/pytest-dev/pytest-order/blob/main/old_issues.md)
and pull requests already existing in `pytest-ordering`.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pytest-dev/pytest-order",
    "name": "pytest-order",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "mrbean-bremen",
    "author_email": "hansemrbean@googlemail.com",
    "download_url": "https://files.pythonhosted.org/packages/1d/66/02ae17461b14a52ce5a29ae2900156b9110d1de34721ccc16ccd79419876/pytest_order-1.3.0.tar.gz",
    "platform": null,
    "description": "_pytest-order_ - a pytest plugin to order test execution\n========================================================\n\n[![PyPI version](https://badge.fury.io/py/pytest-order.svg)](https://pypi.org/project/pytest-order) [![Testsuite](https://github.com/pytest-dev/pytest-order/workflows/Testsuite/badge.svg)](https://github.com/pytest-dev/pytest-order/actions?query=workflow%3ATestsuite) [![DocBuild](https://readthedocs.org/projects/pytest-order/badge/?version=latest)](https://pytest-order.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/pytest-dev/pytest-order/branch/main/graph/badge.svg?token=M9PHWZSHUU)](https://codecov.io/gh/pytest-dev/pytest-order) [![Python version](https://img.shields.io/pypi/pyversions/pytest-order.svg)](https://pypi.org/project/pytest-order)\n\n`pytest-order` is a pytest plugin that allows you to customize the order in which\nyour tests are run. It uses the marker `order` that defines when a specific\ntest shall run, either by using an ordinal number, or by specifying the\nrelationship to other tests.\n\n`pytest-order` is a fork of\n[pytest-ordering](https://github.com/ftobia/pytest-ordering) that provides\nadditional features like ordering relative to other tests.\n\n`pytest-order` works with Python 3.7 - 3.12, with pytest\nversions >= 5.0.0 for all versions up to Python 3.9, and for pytest >=\n6.2.4 for Python >= 3.10. `pytest-order` runs on Linux, macOS and Windows.\n\nDocumentation\n-------------\nApart from this overview, the following information is available:\n- usage documentation for the [latest release](https://pytest-order.readthedocs.io/en/stable/)\n- usage documentation for the [current main branch](https://pytest-order.readthedocs.io/en/latest/)\n- most examples shown in the documentation can also be found in the\n  [repository](https://github.com/pytest-dev/pytest-order/tree/main/example)\n- the [Release Notes](https://github.com/pytest-dev/pytest-order/blob/main/CHANGELOG.md)\n  with a list of changes in the latest versions\n- a [list of open issues](https://github.com/pytest-dev/pytest-order/blob/main/old_issues.md)\n  in the original project and their handling in `pytest-order`\n\nFeatures\n--------\n`pytest-order` provides the following features:\n- ordering of tests [by index](https://pytest-order.readthedocs.io/en/stable/usage.html#ordering-by-numbers)\n- ordering of tests both from the start and from the end (via negative\n  index)\n- ordering of tests [relative to each other](https://pytest-order.readthedocs.io/en/stable/usage.html#order-relative-to-other-tests)\n  (via the `before` and `after` marker attributes)\n- session-, module- and class-scope ordering via the\n  [order-scope](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-scope) option\n- directory scope ordering via the\n  [order-scope-level](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-scope-level) option\n- hierarchical module and class-level ordering via the\n  [order-group-scope](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-group-scope) option\n- ordering tests with `pytest-dependency` markers if using the\n  [order-dependencies](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-dependencies) option,\n  more information about `pytest-dependency` compatibility\n  [here](https://pytest-order.readthedocs.io/en/stable/other_plugins.html#relationship-with-pytest-dependency)\n- sparse ordering of tests via the\n  [sparse-ordering](https://pytest-order.readthedocs.io/en/stable/configuration.html#sparse-ordering) option\n- usage of custom markers for ordering using the\n  [order-marker-prefix](https://pytest-order.readthedocs.io/en/stable/configuration.html#order-marker-prefix) option\n\nOverview\n--------\n_(adapted from the original project)_\n\nHave you ever wanted to easily run one of your tests before any others run?\nOr run some tests last? Or run this one test before that other test? Or\nmake sure that this group of tests runs after this other group of tests?\n\nNow you can.\n\nInstall with:\n\n    pip install pytest-order\n\nThis defines the ``order`` marker that you can use in your code with\ndifferent attributes.\n\nFor example, this code:\n\n    import pytest\n\n    @pytest.mark.order(2)\n    def test_foo():\n        assert True\n\n    @pytest.mark.order(1)\n    def test_bar():\n        assert True\n\nyields the output:\n\n    $ pytest test_foo.py -vv\n    ============================= test session starts ==============================\n    platform darwin -- Python 3.7.1, pytest-5.4.3, py-1.8.1, pluggy-0.13.1 -- env/bin/python\n    plugins: order\n    collected 2 items\n\n    test_foo.py:7: test_bar PASSED\n    test_foo.py:3: test_foo PASSED\n\n    =========================== 2 passed in 0.01 seconds ===========================\n\nContributing\n------------\nContributions are very welcome. Tests can be run with\n[tox](https://tox.readthedocs.io/en/latest/), please ensure\nthe coverage at least stays the same before you submit a pull request.\n\nLicense\n-------\nDistributed under the terms of the [MIT](http://opensource.org/licenses/MIT)\nlicense, `pytest-order` is free and open source software.\n\nHistory\n-------\nThis is a fork of [pytest-ordering](https://github.com/ftobia/pytest-ordering).\nThat project is not maintained anymore, and there are several helpful PRs\nthat are now integrated into `pytest-order`. The idea and most of the\ninitial code has been created by Frank Tobia, the author of that plugin, and\n[contributors](https://github.com/pytest-dev/pytest-order/blob/main/AUTHORS).\n\nWhile derived from `pytest_ordering`, `pytest-order` is **not** compatible\nwith `pytest-ordering` due to the changed marker name (`order` instead of\n`run`). Additional markers defined in `pytest_ordering` are all integrated\ninto the `order` marker (for a rationale see also\n[this issue](https://github.com/ftobia/pytest-ordering/issues/38)).\n\nOrdering relative to other tests and all the configuration options are not\navailable in the released version of `pytest-ordering`.\nHowever, most of these features are derived from or inspired by\n[issues](https://github.com/pytest-dev/pytest-order/blob/main/old_issues.md)\nand pull requests already existing in `pytest-ordering`.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "pytest plugin to run your tests in a specific order",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/pytest-dev/pytest-order"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b7359b038d1aafca89f8e9936eaa8ffa6bb6138d00459d13a32ce070be4f280",
                "md5": "7fb73d8000fbc20535ab90823e230b24",
                "sha256": "2cd562a21380345dd8d5774aa5fd38b7849b6ee7397ca5f6999bbe6e89f07f6e"
            },
            "downloads": -1,
            "filename": "pytest_order-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7fb73d8000fbc20535ab90823e230b24",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 14609,
            "upload_time": "2024-08-22T12:29:53",
            "upload_time_iso_8601": "2024-08-22T12:29:53.156968Z",
            "url": "https://files.pythonhosted.org/packages/1b/73/59b038d1aafca89f8e9936eaa8ffa6bb6138d00459d13a32ce070be4f280/pytest_order-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d6602ae17461b14a52ce5a29ae2900156b9110d1de34721ccc16ccd79419876",
                "md5": "f929658fd82b61ff37fb4e43221b0e68",
                "sha256": "51608fec3d3ee9c0adaea94daa124a5c4c1d2bb99b00269f098f414307f23dde"
            },
            "downloads": -1,
            "filename": "pytest_order-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f929658fd82b61ff37fb4e43221b0e68",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 47544,
            "upload_time": "2024-08-22T12:29:54",
            "upload_time_iso_8601": "2024-08-22T12:29:54.512753Z",
            "url": "https://files.pythonhosted.org/packages/1d/66/02ae17461b14a52ce5a29ae2900156b9110d1de34721ccc16ccd79419876/pytest_order-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-22 12:29:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pytest-dev",
    "github_project": "pytest-order",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "pytest-order"
}
        
Elapsed time: 0.32054s