Skip to content

pytest

pytest CI on GitHub Actions

pytest runs on one core while the runner has eight idle.

1 → 8
Cores used
18m → 3m
Test suite

pytest runs on one core while the runner has eight idle.

Why it happens

pytest is serial unless pytest-xdist is installed and enabled.

What to change

  1. Run with -n auto using pytest-xdist
  2. Group tests that share fixtures with --dist loadgroup to avoid setup thrash
  3. Cache .pytest_cache and the virtualenv
  4. Split slow integration tests into a separate job

pytest on runnerhut

yaml
jobs:
test:
runs-on: runnerhut-8vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv sync --frozen
- run: uv run pytest -n auto --dist loadgroup -q
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-8vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.

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.