Registry / testing / pytest-ordering

pytest-ordering

JSON →
library0.6pypypi✓ verified 26d ago

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.

pip install pytest-ordering
INSTALL
IMPORT
SIG · PYTEST-ORDERING
P
pytest-ordering
testingpythonv0.6
Install
2.7s avg
Import
415ms
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.422s · 31.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.7s · import 0.408s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_configure
from pytest_ordering import pytest_configure
import pytest
pytest_collection_modifyitems
from pytest_ordering import pytest_collection_modifyitems
import pytest
operator
from pytest_ordering import operator
import pytest

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)
Debug
Known issues
breakingThe `pytest-ordering` project is no longer maintained. It is highly recommended to migrate to `pytest-order` for continued support and new features.
fix
Uninstall `pytest-ordering` and install `pytest-order`. Update test markers from `@pytest.mark.run(order=X)` to `@pytest.mark.order(X)`. Refer to `pytest-order` documentation for migration details.
affects: <=0.6
breakingWhen migrating from `pytest-ordering` to `pytest-order`, the marker name changes from `run` to `order`. Using `pytest.mark.run` with `pytest-order` will not work.
fix
Replace `@pytest.mark.run(order=X)` with `@pytest.mark.order(X)` in your tests.
affects: <=0.6
gotchaRelying on specific test execution order is generally considered a bad practice in testing, as it can indicate hidden dependencies between tests and lead to flaky tests. This plugin facilitates such ordering, but it's important to be aware of the potential downsides.
fix
Refactor tests to be independent and self-contained whenever possible. If ordering is strictly necessary (e.g., for integration tests with state), ensure dependencies are clearly documented and managed.
affects: All versions
gotchaUsing `pytest-ordering` (or any ordering plugin) with other plugins that modify test execution order (e.g., `pytest-xdist`, `pytest-random-order`, `pytest-dependency`) can lead to unpredictable or overridden test orders due to plugin interaction and execution precedence.
fix
Carefully review the documentation for all installed pytest plugins, especially those affecting test collection or execution order. Test your suite thoroughly to ensure the desired order is maintained. For `pytest-xdist`, consider `--dist=loadfile` for better compatibility.
affects: All versions
Upgrade
Version history
0.6latest on PyPI · released Nov 14, 2018
Audit
Dependencies
pytestrequiredCore testing framework; this is a plugin for pytest.
Agent activity
5 hits · last 30 days
node
4
Resources
pytest-ordering — pip install pytest-ordering · libregistry