Skip to main content

pytest plugin to run your tests in a specific order

Project description

pytest-order - a pytest plugin to order test execution

PyPI version Testsuite DocBuild Coverage Status Python version

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 be run relative to the other tests.

pytest-order works with Python 2.7 and 3.5 - 3.9, with pytest versions >= 3.7.0, and runs on Linux, MacOs and Windows.

Documentation

Apart from this overview, the following information is available:

History

This is a fork of 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 code has been created by Frank Tobia, the author of that plugin, and contributors.

Compatibility with pytest_ordering

pytest-order is not compatible with pytest-ordering due to the changed marker name (order instead of run). Only the order marker is supported, support for all additional markers has been removed for consistence (as has been discussed in this issue).

Overview

(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:

$ py.test 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 ===========================

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-order-0.9.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_order-0.9.2-py2.py3-none-any.whl (7.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest-order-0.9.2.tar.gz.

File metadata

  • Download URL: pytest-order-0.9.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.7.1

File hashes

Hashes for pytest-order-0.9.2.tar.gz
Algorithm Hash digest
SHA256 b484a98070a95f01b4224575509b9b5a67654c61c574e44143c082798c6257c5
MD5 5c3e644529c1eb11d35138ead8373382
BLAKE2b-256 a4d26e4a2130eb07d3c1e06eccedc7b96086bc1295f52ca17e673f30b5d36f77

See more details on using hashes here.

File details

Details for the file pytest_order-0.9.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_order-0.9.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/3.7.1

File hashes

Hashes for pytest_order-0.9.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a4e8e94b5870557567378fbf2b86d1a1102496fbbe4337df0cb7f044ca8a4610
MD5 1caa7e07fd05f3c5f490eba600845d1c
BLAKE2b-256 66d2151b17c284aa5ab7d54cc5ef69811f588bd1584aa9f2ed90552781f78455

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page