{"id":2236,"library":"pytest-ordering","title":"pytest-ordering","description":"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.","status":"abandoned","version":"0.6","language":"en","source_language":"en","source_url":"https://github.com/ftobia/pytest-ordering","tags":["pytest","testing","order","deprecated","plugin"],"install":[{"cmd":"pip install pytest-ordering","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core testing framework; this is a plugin for pytest.","package":"pytest"}],"imports":[{"note":"The 'order' marker is used by the successor `pytest-order` and is incompatible with `pytest-ordering`.","wrong":"import pytest\n@pytest.mark.order(1)","symbol":"pytest.mark.run","correct":"import pytest\n@pytest.mark.run(order=1)"}],"quickstart":{"code":"import pytest\n\ndef test_c():\n    assert True\n\n@pytest.mark.run(order=2)\ndef test_foo():\n    assert True\n\n@pytest.mark.run(order=1)\ndef test_bar():\n    assert True\n\n# To run: pytest your_test_file.py -v\n# Expected order: test_bar, test_foo, test_c (tests without explicit order might run last, or alphabetically among themselves)","lang":"python","description":"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."},"warnings":[{"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.","message":"The `pytest-ordering` project is no longer maintained. It is highly recommended to migrate to `pytest-order` for continued support and new features.","severity":"breaking","affected_versions":"<=0.6"},{"fix":"Replace `@pytest.mark.run(order=X)` with `@pytest.mark.order(X)` in your tests.","message":"When 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.","severity":"breaking","affected_versions":"<=0.6"},{"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.","message":"Relying 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Using `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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}