--- id: pytest-split version: "0.11.0" license: MIT license_treatment: permissive maintenance: active --- # pytest-split — Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. License: permissive · Maintenance: active · Downloads: 21.0M/mo ## 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 above — 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 pip install pytest-split uv add pytest-split 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_current - Install friction: low - Maintenance: active - Downloads: 21.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest test suite splitting, parallel test execution, distribute tests by duration, pytest parallelization, balanced test groups, pytest CI optimization, test suite partitioning, ci-optimization, test-parallelization [View on SkillFed](https://skillfed.io/packages/pytest-split) · [View on PyPI](https://pypi.org/project/pytest-split/)