Run tests in parallel with pytest-xdist (v2) - #9945
Open
akx wants to merge 7 commits into
Open
Conversation
* pytest-xdist is only needed by the invocations that actually run in parallel * --numprocesses=logical additionally needs psutil This follows test-arrow style.
Let the tests and test-xdist extras be the single source of truth for tests/distributed-tests extras.
Pass the options at each call site rather than putting them in addopts, so pytests may also run without test-xdist. REVERSE dropped because xdist runs tests in arbitrary order anyhow. That matrix entry still does PYTHONOPTIMIZE=1. Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* ru_maxrss never falls, so leak tests were measuring occasional transient spikes, not true leaks. Instead, for leak tests we now read the current RSS, which falls (to a degree, depending on system allocator strategy) when memory is released, and also doesn't depend on the process's past. * The tests' limits were adjusted based on empirical measurements. * psutil is brought in by the test-xdist extra from before, but also test-leaks.
…surement unreliable
The tall case still needs to allocate the row-pointer table `im->image`, which is still roughly 700 megabytes, which evidently can be slow
Contributor
Author
|
cc @hugovk, this is based on your xdist work :) |
akx
marked this pull request as ready for review
September 2, 2026 18:26
Member
|
For future reference, I think this could have been a PR for hugovk's fork, to update the existing PR, rather than a brand new PR for this repository. |
Contributor
Author
|
@radarhere Thanks. Yes, that had been my initial plan. I decided against that because #9342 has conflicts against |
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9342 (supersedes it).
Closes #9933 (this contains those commits).
Related to #9944 (comment).
This PR:
psutil, sinceresource.getrusage()can't.psutilcan measure things there too, but there's probably no point.test_empty_imagesize for the "tall" case to 0 × 10,000,000 instead of 0 × 100,000,000, since a 0 × H size image still requires allocating H row pointers. This gets rid of the transient timeout for that test -- my guess is that sometimes allocating that much space (with zeroing, so the OS can't just allocate pages for later touching!) takes a bit of time.