skillfed

pytest-reverse

Pytest plugin to reverse test order.

pytest-reverse v1.9.0 75.0K downloads/30d#14,761 on PyPI29
Permissive license MIT Active released

What it is and what it does

pytest-reverse is a pytest plugin that reverses the order in which tests are executed. It works by adding a --reverse flag to pytest, allowing you to run your test suite backwards instead of in the default or randomized order. The plugin is automatically discovered by pytest once installed.

Test reversal helps identify tests that depend on execution order or shared state—a common source of flaky tests and false positives. By running tests in reverse, you can detect whether a passing test only passes because an earlier test set up some state, or whether a test fails only when preceded by a specific other test. This is a lightweight alternative to full randomization for uncovering test isolation issues.

Use it for:

  • Run your test suite backwards to catch tests that pass only due to side effects from earlier tests.
  • Debug flaky tests by checking if they fail when executed in reverse order.
  • Add --reverse to pytest.ini to make reverse execution the default for your project.
  • Verify test independence before committing code that modifies test fixtures or setup.
  • Complement randomized testing strategies with a deterministic reverse run.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that runs tests in reverse order to detect test interdependencies and ordering issues.

Yes. Low install friction, no security issues, actively maintained, and a focused tool that solves a real problem in test reliability. Useful for any project where test ordering might mask failures or dependencies.

Install

pytest-reverse on PyPI

pip

pip install pytest-reverse

uv

uv add pytest-reverse

poetry

poetry add pytest-reverse

Installing pytest-reverse

Before you install

Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with recent releases; last commit 2026-08-13.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal obligations.

Quickstart

pip install pytest-reverse
pytest --reverse

Requires Python 3.9 or later.

Verify before relying

  • Whether test reversal alone is sufficient to catch all ordering-dependent failures or if it works best combined with other techniques.
  • Performance impact when reversing large test suites.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — pytest
Maintenance actively maintained — 339 days since the last release
Last repo commit
First released
Downloads 74,991/month — #14,761 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_reverse-1.9.0-py3-none-any.whl

Keywords: pytest, reverse

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Typing :: Typed

Tags

pytest reverse test ordertest execution orderdetect test dependenciespytest plugin orderingreverse test sequencetest isolation verificationpytest test reordering
test-isolationpytest-plugin

More Testing packages