pytest-split
Pytest plugin which splits the test suite to equally sized sub suites based on test execution time.
What it is and what it does
pytest-split is a pytest plugin that organizes test execution into balanced parallel groups by analyzing how long each test takes to run. It stores test duration data in a .test_durations file, then uses that history to divide tests into sub-suites with roughly equal total execution time. This is useful for CI pipelines where you want to run tests in parallel across multiple workers without some workers finishing much earlier than others.
The plugin handles test suite changes gracefully: new tests get assigned an average duration estimate, and removed tests are simply skipped. It offers two splitting algorithms—duration_based_chunks (maintains absolute test order) and least_duration (better balance, works with test randomization)—and includes special handling for notebook-based tests via nbval integration. The main constraint is incompatibility with test randomization plugins when using the default algorithm, though a workaround exists via shared random seeds.
Use it for:
- Divide a test suite across multiple CI workers to parallelize builds while keeping wall-clock time balanced.
- Identify and list the slowest tests in your suite using the slowest-tests CLI command for optimization.
- Maintain test order stability in fragile suites that depend on execution sequence while still splitting for parallel CI.
- Automatically handle new and removed tests without re-running --store-durations after every change.
- Run notebook-based tests split across groups without breaking imports or cell dependencies.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that divides a test suite into balanced groups based on recorded test execution times, enabling parallel test execution with predictable runtime per group.
Yes. Low install friction, active maintenance, no security vulnerabilities, and MIT licensing make this a safe choice. Install it if you run tests in parallel CI and want to avoid the unbalanced execution times that naive splitting produces. Skip it only if you use test randomization plugins and cannot coordinate a shared seed across workers.
Install
pytest-split on PyPI
pip
pip install pytest-splituv
uv add pytest-splitpoetry
poetry add pytest-splitInstalling pytest-split
Before you install
Low friction: pure Python wheel with only pytest as a runtime dependency. Actively maintained with recent releases; last commit 2026-03-01 and 323 repository stars indicate ongoing support.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install pytest-split
# First run: store test durations
pytest --store-durations
# Then split across workers
pytest --splits 3 --group 1 # worker 1
pytest --splits 3 --group 2 # worker 2
pytest --splits 3 --group 3 # worker 3
Requires Python 3.10 or later. Incompatible with pytest-randomly or pytest-random-order unless a global random seed is pre-computed and passed via --random-order-seed to all groups.
Verify before relying
- Whether the .test_durations file format is stable across versions and safe to commit to version control
- Performance impact of the splitting algorithm on large test suites
- Compatibility details with CI/CD platforms beyond the GitHub Actions demo
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | actively maintained — 192 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 20,969,797/month — #1,020 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_split-0.11.0-py3-none-any.whl
Keywords: pytest, plugin, split, tests
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
pytest-split-testsA pytest plugin that splits your test suite…
permissive · top 15,000 on PyPI
pytest-test-groupspytest-test-groups is a pytest plugin that…
permissive · top 5,000 on PyPI
pytest-circleci-parallelizedAdds a pytest plugin that automatically…
permissive · top 15,000 on PyPI
pytest-item-dictA pytest plugin that builds hierarchical…
unclear · top 15,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
pytest-extra-durationsA pytest plugin that reports test execution…
permissive · top 15,000 on PyPI
pytest-random-orderA pytest plugin that randomizes the order in…
permissive · top 5,000 on PyPI
pytest-randomlyA pytest plugin that randomly shuffles test…
permissive · top 5,000 on PyPI
pytest-reverseA pytest plugin that runs tests in reverse…
permissive · top 15,000 on PyPI
pytest-durationsA pytest plugin that measures and reports…
permissive · top 5,000 on PyPI