build(test): add pytest-xdist for parallel test execution#1218
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ 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. Comment |
rd4398
left a comment
There was a problem hiding this comment.
Looks good to me! For some reason CI is failing :(
|
Tick the box to add this pull request to the merge queue (same as
|
|
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. |
`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>
Pull Request Description
What
Add
pytest-xdistto test dependencies and configure 3 parallel workers viaaddopts. 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.