pytest-random-order
Randomise the order in which pytest tests are run with some control over the randomness
Decision gist · record as of 2026-08-14
Yes. This is a lightweight, actively maintained plugin with zero security issues and a clear, narrow purpose: catching test order dependencies. Install it if you want to harden your test suite against hidden interdependencies. The opt-in design means it won't affect existing test runs unless you explicitly enable it.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction: pure Python wheel with only pytest as a runtime dependency.
- Actively maintained with recent commits and stable production status.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
last release 2025-06-22 (418 days) · last repo commit 2026-08-10 · 79 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,844,743 downloads/mo, #2,864 on PyPI
Alternatives
Verify before relying
pip install pytest-random-order
# In pytest.ini or pyproject.toml:
# [pytest]
# addopts = --random-order
# Or run: pytest --random-order- Whether the plugin's bucket types (class, module, package, global, etc.) cover all real-world test organization patterns users encounter.
What it is and what it does
pytest-random-order is a pytest plugin that shuffles the order in which tests execute, with fine-grained control over randomization scope. By default it does not randomize; you opt in via command-line flag or configuration. The plugin groups tests into buckets (by class, module, package, or globally) and shuffles within and across buckets, allowing you to detect tests that pass only because they run after another test that leaves the system in a particular state—a common source of hidden test fragility.
The plugin reports the random seed used in each run, so if a specific test order reveals a failure, you can reproduce it exactly by passing that seed back. It also supports disabling randomization for specific modules or classes, respects pytest's failed-first flag, and can be disabled entirely if needed. It integrates seamlessly as a pytest plugin with no external dependencies beyond pytest itself.
Use it for
- Detect tests that depend on execution order or shared state by running them in random order and catching failures that don't occur in default order.
- Reproduce a specific test failure by rerunning with the seed value reported in the original test output.
- Verify test isolation at module or package scope before moving to more aggressive global randomization.
- Disable randomization for known-fragile test classes while randomizing the rest of the suite.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a lightweight, actively maintained plugin with zero security issues and a clear, narrow purpose: catching test order dependencies. Install it if you want to harden your test suite against hidden interdependencies. The opt-in design means it won't affect existing test runs unless you explicitly enable it.
Install
pytest-random-order on PyPI
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with recent commits and stable production status.
Requires Python 3.9 or later.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install pytest-random-order
# In pytest.ini or pyproject.toml:
# [pytest]
# addopts = --random-order
# Or run: pytest --random-order
Verify before relying
- Whether the plugin's bucket types (class, module, package, global, etc.) cover all real-world test organization patterns users encounter.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 418 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,844,743 / month, #2,864 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: Testing |
Evidence: pytest_random_order-1.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest test order randomization”
- pytest-random-orderA pytest plugin that randomizes the order in which tests run, helping…
- pytest-randomlyA pytest plugin that randomly shuffles test execution order and…
- pytest-reverseA pytest plugin that runs tests in reverse order to detect test…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-randomly · pytest-reverse · pytest-rng · pytest-split · pytest-isort · random2 · pytest-retry · pytest-ordering · flaky · pytest-rerunfailures