pytest-dev / pytest-dev/pytest-xdist
Performance idea: `--sf`/`--slow-first` option to improve resource utilization
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
Reading this blog post about Stripe's test runner made me think we should have a --slow-first option for xdist, and it seems that we don't yet 😅 The motivation for --slow-first is that fastest-tests-last is a great heuristic to reduce the duration at the end of a test run when some processes are done but others are still running - which can range from negligible to "several times longer than the rest of the run" (when e.g. I select mostly fast unit tests, plus a few slow integration tests which happen to run last).
IMO this should be lower priority than --last-failed, only reorder passing tests for --failed-first, and be incompatible with --new-first (existing flag docs). The main trick is to cache durations from the last run, and then order by the aggregate time for each loadscope (i.e. method, class, or file, depending on what we'll distribute - pytest-randomly is useful prior art).
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 reviewing the existing --last-failed, --failed-first, and --new-first flag documentation, then compare pytest-randomly's ordering approach. The issue's done criteria are cached test durations, aggregate timing per loadscope, fastest-tests-last ordering, and the stated priority and compatibility rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100