Skip to content

build(test): add pytest-xdist for parallel test execution#1218

Merged
mergify[bot] merged 1 commit into
python-wheel-build:mainfrom
tiran:add-pytest-xdist
Jun 25, 2026
Merged

build(test): add pytest-xdist for parallel test execution#1218
mergify[bot] merged 1 commit into
python-wheel-build:mainfrom
tiran:add-pytest-xdist

Conversation

@tiran

@tiran tiran commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Description

What

Add pytest-xdist to test dependencies and configure 3 parallel workers via addopts. Testing showed that 4 or more workers does not provide measurable benefits.

See https://pytest-xdist.readthedocs.io/en/stable/

Why

Speed up local testing. On my machine, unit tests now takes less than 4 seconds instead of 12 seconds.

Add `pytest-xdist` to test dependencies and configure 3 parallel
workers via `addopts`. Testing showed that 4 or more workers does not
provide measurable benefits.

See https://pytest-xdist.readthedocs.io/en/stable/

Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran requested a review from a team as a code owner June 25, 2026 10:08
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 41d238ff-3c6e-4d42-80d7-832a269f15e9

📥 Commits

Reviewing files that changed from the base of the PR and between 694f04f and 3c92bb0.

📒 Files selected for processing (1)
  • pyproject.toml

📝 Walkthrough

Walkthrough

pyproject.toml now includes pytest-xdist in the test extra. Pytest is configured with addopts = "-n 3", which sets the default xdist worker count to three.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding pytest-xdist for parallel test execution.
Description check ✅ Passed The description matches the change by explaining the new dependency, 3-worker configuration, and the performance goal.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify mergify Bot added the ci label Jun 25, 2026

@rd4398 rd4398 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me! For some reason CI is failing :(

@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mergify mergify Bot merged commit dbe3a48 into python-wheel-build:main Jun 25, 2026
38 of 39 checks passed
@tiran

tiran commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Yes, there is an issue with coverage and xdist. I have a local fix, but I haven't pushed it yet.

I'm creating a new PR.

@tiran tiran deleted the add-pytest-xdist branch June 25, 2026 13:41
mergify Bot pushed a commit that referenced this pull request Jun 25, 2026
`coverage run` only instruments the main process. With pytest-xdist,
test workers are spawned as separate processes and their coverage is
lost. Replace `coverage run -m pytest` with `pytest --cov`, which
uses pytest-cov to instrument xdist workers correctly.

Follow-up to #1218.

Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants