pytest-ordering

0.6 · abandoned · verified Thu Apr 09

pytest-ordering is a pytest plugin designed to enable users to run tests in a specific, user-defined order. The latest version is 0.6, released in 2018. This project is no longer maintained, and users are strongly advised to migrate to its successor, `pytest-order`, which provides active development and additional features.

Warnings

Install

Imports

Quickstart

Define test execution order using the `@pytest.mark.run(order=X)` decorator. Tests with lower 'order' values run first. Tests without an explicit order may run in their natural discovery order (e.g., alphabetical or by line number) relative to each other, but after explicitly ordered tests.

import pytest

def test_c():
    assert True

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

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

# To run: pytest your_test_file.py -v
# Expected order: test_bar, test_foo, test_c (tests without explicit order might run last, or alphabetically among themselves)

view raw JSON →