-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add parallel test target, using pytest-xdist #8972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
That's a huge improvement! Shall we just make it the default? Then it'll be used through make, tox, and direct pytest. --- a/pyproject.toml
+++ b/pyproject.toml
[tool.pytest.ini_options]
-addopts = "-ra --color=yes"
+addopts = "-ra --color=yes --numprocesses=auto" Although it does change the (pytest and tox) output from:
To:
One option is to add pytest-sugar to
|
I think the format change is the One interesting thing -- if we do this, we're going to be running parallel tests on freethread python, which would definitely be a good thing. Edit -- looks like #8492 is actually referring to pytest-run-parallel, which is threads. |
The only thing that we'd have to be careful of is the valgrind tests can only run in one process |
The formatting change also happens when running plain |
I don't care that much about what the format is, other than I want fast tests when I'm iterating. Shorter CI logs aren't a bad thing, but there's a lot less context when you're tailing them. |
@@ -95,7 +95,13 @@ sdist: | |||
.PHONY: test | |||
test: | |||
python3 -c "import pytest" > /dev/null 2>&1 || python3 -m pip install pytest | |||
python3 -m pytest -qq | |||
python3 -m pytest -qq Tests/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
@@ -70,6 +70,7 @@ optional-dependencies.tests = [ | |||
"pytest", | |||
"pytest-cov", | |||
"pytest-timeout", | |||
"pytest-xdist", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the Makefile is going to install pytest-xdist by itself, and we're not using it anywhere else, I don't think this needs to be in pyproject.toml?
Changes proposed in this pull request:
This seems to be running 4 runners on an 8 core machine, for about a 2.5x speedup. Note that this is on the standard with GIL python, but I'm seeing 1.5x the user time.
-n 8
on this machine doesn't speed up the wall clock time much (2-4%, but does significantly add to user time.(note, these numbers are a 8 core intel server in the cloud, probably 5 years old at this point)
On an M4 Air