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.
Documentation
Apart from this overview, the following information is available:
- usage documentation for the latest release
- usage documentation for the current master
- the Release Notes with a list of changes in the latest versions
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. In case
pytest-ordering
is revived, this project will be obsolete.
Compatibility to 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 (see 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.run(order=2)
def test_foo():
assert True
@pytest.mark.run(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 ===========================
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
Hashes for pytest_order-0.8.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8070f5d4fcfe1e7bdff86fdb13c9d7780a9e130d615a64a23f04c5d84950a219 |
|
MD5 | f6585086bbc8c93574da1dca33c06d89 |
|
BLAKE2b-256 | 2225316afaf7a9d7f8b7e20a38bd47ef3eb8ca8f2c5ad60e7caa96e53fe5646f |