pytest-dev / pytest-dev/pytest-xdist

Feature request: mark number of cores consumed by a test

Open
#593 7 comments 0 reactions 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

One of my workflows runs a third-party program that runs at 300-400% CPU utilization with no way to control the number of cores/threads used. When I run the workflow's test suite with pytest -n 8, eight test functions will run simultaneously. But the actual CPU utilization could be much higher depending on how many tests running this third-party program are active at the same time. I can do a bit of quick math to compensate and run fewer parallel worker processes, but then the rest of the test suite runs more slowly when that program is not being run.

If there were a way to mark the relevant test functions and say "this function consumes 4 CPUs", then it would be possible to strike the ideal balance between using all available CPUs and not overwhelming the system.

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 with the pytest -n 8 workflow and the test functions that invoke the third-party program. Define how tests declare their CPU consumption and verify that scheduling accounts for those values while keeping other tests parallel; the issue names no files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.