pytest-dev / pytest-dev/pytest-xdist
Feature request: Add option to include logical CPUs (threads) in cpu count
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
Hi,
as a side effect of using psutil in [0] pytest-xdist will now only count physical cores instead of threads. (using logical=False).
This results in radical undercounting for heavily threaded architectures (like power9 -- 8 threads per core).
It'd be useful if pytest-xdist could provide --count-logical or equivalent that would include CPU threads in pytest-xdist scaling decisions.
Using -n `nproc` works as a workaround, but a native xdist support would be nice.
[0] https://github.com/pytest-dev/pytest-xdist/commit/607d8288d40bd87196e354e561d3f26236f850f8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating pytest-xdist's CPU-count logic and command-line option handling, then trace how the current physical-core count affects scaling decisions. Add coverage for including logical CPUs and verify the new option preserves the existing behavior when it is not enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100