pytest-dev / pytest-dev/pytest-xdist
collection efficiency with many tests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
We've been running the patch from https://github.com/pytest-dev/pytest-xdist/issues/299 successfully for a while. One thing I've noticed is that with large test suites, it can take a while before the first worker begins running tests.
From what I can tell, this is due to collection overhead: with execnet debugging on, that's all that's going on during that time. Disabling workers from sending pytest_collectreport keeps the master idle during the time but doesn't speed things up, so presumably the bottleneck is the workers themselves. The collection time also does not seem affected by the number of workers.
Interestingly, collection under xdist seems much slower than just pytest: in my example of ~16k tests, it's ~1 minute vs ~4 minutes. My guess is there's something like https://github.com/pytest-dev/pytest-xdist/issues/279 going on.
Next I'm hoping to try profiling the workers during collection, but since that looks like it'll be painful I figured I'd ask for advice first. Is there anything notable that xdist collection does differently from pytest?
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
Reproduce the reported comparison between pytest and xdist with a large test suite, then profile the workers during collection as suggested. Read the behavior around pytest_collectreport and compare it with the related issues 299 and 279. Done means identifying the collection bottleneck and documenting a concrete direction for reducing the delay before workers begin running tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, performance, testing-qa
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100