pytest plugin to run your tests in a specific order
Project description
pytest-order - a pytest plugin to order test execution
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 is a fork of
pytest-ordering that provides
some additional features - see below for
details.
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:
- usage documentation for the latest release
- usage documentation for the current master
- all examples shown in the documentation can also be found in the repository
- the Release Notes with a list of changes in the latest versions
- a list of open issues
in the original project and their handling in
pytest-order
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 ===========================
Features
pytest-order provides the following features:
- ordering of tests by index, as shown above
- ordering of tests both from the start and from the end (via negative index)
- ordering of tests relative to each other (via the
beforeandaftermarker attributes) - session-, module- and class-scope ordering via the
order-scopeoption - hierarchical ordering via the
group-order-scopeoption - ordering tests with
pytest-dependencymarkers if using theorder-dependenciesoption - sparse ordering of tests via the
sparse-orderingoption - invocation of the plugin before other plugins if the
indulgent-orderingoption is used
A usage guide for each feature can be found in the documentation.
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.
Comparison with pytest_ordering
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 are integrated into the order marker (for a
rationale see also
this issue).
Ordering relative to other tests and all of the configuration options are not
available in the released version of pytest-ordering.
However, most of these features are derived from
issues
and pull requests already existing in pytest-ordering.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest-order-0.9.5.tar.gz.
File metadata
- Download URL: pytest-order-0.9.5.tar.gz
- Upload date:
- Size: 33.9 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9e4f1b060414c642e88ad98ca60f1fd37937debd704bd8f4a2ef8e08b9cb6d
|
|
| MD5 |
207eee58e37ee1275db212e2accd0300
|
|
| BLAKE2b-256 |
81ecfbac1322337740af54852aee789f9508209ccf065b79051d8c6a51a6f17c
|
File details
Details for the file pytest_order-0.9.5-py2.py3-none-any.whl.
File metadata
- Download URL: pytest_order-0.9.5-py2.py3-none-any.whl
- Upload date:
- Size: 10.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42136c2035417ffb6d29ff27f61346ead4b8f9a400abebc7f0470beda7db2c15
|
|
| MD5 |
0ba38fad4a4c3c54a0560867012c552c
|
|
| BLAKE2b-256 |
8b28af3ed8b6d0daf8c14ce4be0fc7d8fe68b3220b65e82cba77c84f67090bdc
|