Registry / testing / pytest-reverse

pytest-reverse

JSON →
library1.9.0pypypiunverified

A pytest plugin that reverses the order of test execution. Useful for detecting tests that accidentally depend on order or for randomization. Current version 1.9.0, compatible with Python >=3.9.

pip install pytest-reverse
INSTALL
IMPORT
SIG · PYTEST-REVERSE
P
pytest-reverse
testingpythonv1.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

reverse
pytest.mark.reverse
No direct import needed. Use the --reverse CLI flag or @pytest.mark.reverse() mark.

Use --reverse flag to reverse entire test session, or @pytest.mark.reverse() marker to reverse only specific tests.

# Run all tests in reverse order pytest --reverse # Reverse a single test with marker import pytest @pytest.mark.reverse() def test_one(): assert True def test_two(): assert True
Debug
Known issues
gotchaThe --reverse flag reverses the order of tests within each scope (module, class, function). It does NOT reverse the order of test files unless combined with other plugins.
fix
To reverse test file order, use pytest --reverse --co (with pytest-order plugin) or sort test files manually.
affects: all
gotchaUsing @pytest.mark.reverse() at the class level reverses tests within that class, but does not reverse tests outside the class.
fix
Apply marker to each test function you want reversed, or use --reverse for global reversal.
affects: all
deprecatedThe pytest.mark.reverse marker without parentheses (e.g., @pytest.mark.reverse) is deprecated since version 1.7.0 and will be removed in a future release.
fix
Use @pytest.mark.reverse() with parentheses.
affects: >=1.7.0
Upgrade
Version history
1.9.0latest on PyPI · released Sep 9, 2025
Audit
Dependencies
pytestrequiredRequired plugin host. Must be installed.
Agent activity
3 hits · last 30 days
node
2
Bingbot
1
Resources
pytest-reverse — pip install pytest-reverse · libregistry