pytest-randomly
Pytest plugin to randomly order tests and control random.seed.
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained plugin (Production/Stable status, recent release 2026-04-20) with low install friction and no security vulnerabilities. It solves a real testing problem—detecting hidden test dependencies—that can catch subtle bugs. The MIT license imposes no restrictions. Install it if you want to improve test reliability and catch ordering-dependent failures early.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction install with a single runtime dependency on pytest.
- Actively maintained with recent releases; the repository shows 719 stars and the last commit was 2026-08-13, indicating ongoing development.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing use in both open-source and proprietary projects with minimal restrictions.
last release 2026-04-20 (116 days) · last repo commit 2026-08-13 · 719 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 10,021,263 downloads/mo, #1,491 on PyPI
Alternatives
Verify before relying
pip install pytest-randomly
# Then run pytest normally; the plugin auto-activates:
pytest
# Output shows the random seed:
# Using --randomly-seed=1553614239
# Reproduce a failure with:
pytest --randomly-seed=1234- Whether the plugin works reliably with all pytest-xdist configurations and distributed test scenarios
- Performance impact when running large test suites with hundreds or thousands of tests
What it is and what it does
pytest-randomly is a pytest plugin that randomizes test execution order and manages random seeds to expose hidden test dependencies and ensure reproducible test behavior. By default, it shuffles tests at the module, class, and function levels, then resets Python's global random seed before each test to a deterministic value derived from a base seed, the test ID, and an offset. This allows tests that use random data (via factory boy, Faker, NumPy, or Model Bakery) to remain repeatable while still exercising different code paths across runs.
The plugin prints the base random seed at the start of each test run, allowing developers to reproduce failures caused by test ordering or random data by passing that seed back via the `--randomly-seed` flag. It integrates with pytest-xdist for distributed testing and supports custom random generators through an entry point mechanism. Behaviors can be disabled individually with flags like `--randomly-dont-reorganize` or `--randomly-dont-reset-seed`, and the plugin can be completely disabled with `-p no:randomly`.
Use it for
- Detect inter-test pollution by running tests in random order and reproducing failures with a saved seed.
- Ensure factory-generated test data remains consistent across runs while varying between tests.
- Verify that tests do not depend on global state or execution order from other tests.
- Reproduce flaky test failures caused by random data or test ordering by rerunning with the reported seed.
- Validate test quality by exposing assumptions about test isolation and data setup.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained plugin (Production/Stable status, recent release 2026-04-20) with low install friction and no security vulnerabilities. It solves a real testing problem—detecting hidden test dependencies—that can catch subtle bugs. The MIT license imposes no restrictions. Install it if you want to improve test reliability and catch ordering-dependent failures early.
Install
pytest-randomly on PyPI
Before you install
Low friction install with a single runtime dependency on pytest. Actively maintained with recent releases; the repository shows 719 stars and the last commit was 2026-08-13, indicating ongoing development.
Requires Python 3.10 or later.
License in practice
MIT license is permissive, allowing use in both open-source and proprietary projects with minimal restrictions.
Quickstart
pip install pytest-randomly
# Then run pytest normally; the plugin auto-activates:
pytest
# Output shows the random seed:
# Using --randomly-seed=1553614239
# Reproduce a failure with:
pytest --randomly-seed=1234
Verify before relying
- Whether the plugin works reliably with all pytest-xdist configurations and distributed test scenarios
- Performance impact when running large test suites with hundreds or thousands of tests
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 116 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,021,263 / month, #1,491 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 :: 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.14Typing :: Typed |
Evidence: pytest_randomly-4.1.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 random test order”
- pytest-randomlyA pytest plugin that randomly shuffles test execution order and…
- pytest-random-orderA pytest plugin that randomizes the order in which tests run, helping…
- pytest-replayA pytest plugin that records test execution order and timing from…
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-random-order · pytest-reverse · pytest-rng · pytest-find-dependencies · random2 · pytest-order · pytest-ordering · pytest-isort · pytest-split · pytest-replay