Skip to content

test: run pytest with bounded parallel workers - #14

Merged
CruxExperts merged 2 commits into
mainfrom
feature/pytest-xdist-workers
Aug 4, 2026
Merged

CruxExperts merged 2 commits into
mainfrom
feature/pytest-xdist-workers

Conversation

@CruxExperts

Copy link
Copy Markdown
Owner

Summary

  • Add vetted pytest-xdist>=3.8,<4 to the dev dependency group.
  • Run pytest with -n auto --dist worksteal.
  • Cap auto workers at max(1, min(8, floor(os.cpu_count()/2))).
  • Add boundary regression coverage, including odd CPU counts.
  • Isolate Docker integration image tags per xdist worker to prevent teardown races.

This branch includes current main (restic retention safety, cryptography 50.0.0, and health-floor checks) merged without rewriting the published branch.

Verification

  • Worker-cap tests: 8 passed.
  • Live Docker integration: 13 passed with 8 workers.
  • Full suite: 583 passed with 8 workers.
  • Ruff, py_compile, version sync, publishing readiness, generated CLI metadata, config example equality, and diff checks: passed.
  • Independent refreshed-branch review: no material findings.

@CruxExperts
CruxExperts merged commit 92c9953 into main Aug 4, 2026
7 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de18bd46f6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tests/conftest.py
import pytest


def pytest_xdist_auto_num_workers(config: pytest.Config) -> int:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark the xdist hook optional for serial runs

When pytest-xdist is not loaded—for example, a maintainer runs python -m pytest -o addopts='' to debug serially or has only pytest installed—pluggy treats this conftest function as an implementation of an unknown hook and aborts collection with PluginValidationError: unknown hook 'pytest_xdist_auto_num_workers'. Decorating it with @pytest.hookimpl(optionalhook=True) or registering it only when xdist is present preserves that serial fallback.

Useful? React with 👍 / 👎.

Comment thread pyproject.toml
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short -q"
addopts = "-n auto --dist worksteal --tb=short -q"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the parallel pytest default

Because this line changes the repo-wide default uv run pytest behavior from serial execution to xdist work-stealing, it is a maintenance workflow change, but the diff does not update the existing docs or root entry-point docs to explain the new default or how to force serial/debug runs. Add a short note to an existing testing or release-maintenance doc so contributors can reproduce and troubleshoot the new execution policy.

AGENTS.md reference: AGENTS.md:L74-L76

Useful? React with 👍 / 👎.

Comment thread pyproject.toml
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short -q"
addopts = "-n auto --dist worksteal --tb=short -q"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the parallel pytest default

Because this line changes the repo-wide default uv run pytest behavior from serial execution to xdist work-stealing, it is a maintenance workflow change, but the diff does not update the existing docs or root entry-point docs to explain the new default or how to force serial/debug runs. Add a short note to an existing testing or release-maintenance doc so contributors can reproduce and troubleshoot the new execution policy.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant