pytest-dev / pytest-dev/pytest-xdist

Allow one test per node

Open
#894 4 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

The new --maxschedchunk option is great for running test suites with few slow tests.

However, it has a limitation in that it sends two tests to each worker at the start even if --maxschedchunk=1. If tests are sorted by how long they take, the two slowest tests will end up on the same node.

https://github.com/pytest-dev/pytest-xdist/issues/876 sounds like this is not easy to change.

Use-Case

I have a test suite with roughly this kind of runtime distribution:

15 min: 2 tests
5 min: 5 tests
0.5 min: 30 tests

The test fixtures are extremely cheap, much cheaper than the tests themselves. We know pretty well how long each test takes, and sort tests accordingly.

As a workaround, we can take into account xdist's scheduling details in the sorting of tests, but this is confusing and it would be nicer to fix it here.

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 tracing the implementation and tests for the --maxschedchunk scheduler option, then review the scheduling concern in issue #876. Reproduce the case with sorted tests and --maxschedchunk=1; done means the initial scheduling places at most one test on each worker and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.