Skip to content

Guides

How to size runners for Python test suites

pytest is running on one core while the runner has eight idle.

4 min read

pytest is running on one core while the runner has eight idle.

Why it happens

pytest is serial by default, so runner size makes no difference until xdist is enabled.

How to fix it

  1. Enable pytest -n auto before changing runner size — otherwise cores sit idle
  2. 8 vCPU is a good default once xdist is on
  3. Group fixture-sharing tests with --dist loadgroup to avoid setup thrash
  4. Integration tests waiting on a database want fewer cores and faster disk

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.