Skip to content

Investigate parallelizing test_examples.py across CI runners #1306

Description

@lrandersson

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

test_examples.py currently runs as a single serial pytest step per OS/Python/conda-standalone matrix entry in main.yml. Investigate splitting it across multiple parallel jobs/runners per OS, and decide on an approach.

Options to look into:

  • pytest-split (available on conda-forge) — balances test groups by recorded duration; needs a --durations-based baseline, or falls back to even count-splitting.
  • Manual -k/marker-based grouping — no new dependency; tests grouped by hand into buckets and run separately per shard via -k.

Note: some tests touch OS-global state (Windows registry, Start Menu, macOS keychain, a hardcoded C:/ProgramData/conda/.condarc, fixed Docker image tags). Running shards as separate CI jobs/runners avoids collisions from this; running them concurrently on one machine (e.g. pytest-xdist -n auto in a single job) would not, without further changes.

Why is this needed?

Reduce test times, Illustrative arithmetic (current full-run time ÷ N, no overhead accounted for):

OS Full run ÷2 ÷3 ÷4
Windows ~100 min ~50 min ~33 min ~25 min
macOS ~85 min ~43 min ~28 min ~21 min
Linux ~30 min ~15 min ~10 min ~8 min

What should happen?

Examples split into multiple runners, reducing overall testing time.

Additional Context

Decisions needed

  1. Which mechanism to use (pytest-split vs. manual grouping).
  2. Number of shards per OS.
  3. Whether shard boundaries should be based on measured per-test timing (pytest --durations=0) rather than a manual guess.
  4. How to handle steps that assume one test run per matrix entry: coverage upload (Codecov integration flag), the installers-* artifact upload, and the check-docs-schema step.

Notes:

  • pytest-xdist-style same-machine parallelization should not be attempted without first auditing tests that mutate shared OS-global state (e.g. test_initialization registry writes, conftest.py keychain mutation, test_uninstallation_standalone's hardcoded .condarc path, test_docker_image_build's fixed image tag).
  • This issue is for deciding shard count and split mechanism; implementation should follow in a separate PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type::featurerequest for a new feature or capability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions