skillfed

pytest-split

Pytest plugin which splits the test suite to equally sized sub suites based on test execution time.

pytest-split v0.11.0 21.0M downloads/30d#1,020 on PyPI323
Permissive license MIT Active released

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-split

uv

uv add pytest-split

poetry

poetry add pytest-split

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

pytest test suite splittingparallel test executiondistribute tests by durationpytest parallelizationbalanced test groupspytest CI optimizationtest suite partitioning
ci-optimizationtest-parallelization

More Python Modules packages