pytest-dev / pytest-dev/pytest-xdist

Feature request: Add option to include logical CPUs (threads) in cpu count

Open
#602 1 comment 1 reaction 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.