forked from pytest-dev/pytest-xdist
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert psutil dependency and introduce pytest_xdist_auto_num_workers …
…hook This reverts the behavior we had before psutil was a hard dependency, but opens up the possibility of customization through the pytest_xdist_auto_num_workers hook, making things like pytest-dev#477 possible. Fix pytest-dev#585
- Loading branch information
1 parent
e469fc7
commit fb140e2
Showing
5 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
New ``pytest_xdist_auto_num_workers`` hook can be implemented by plugins or ``conftets.py`` to control the number of workers when ``--numprocesses=auto`` is given in the command-line. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
``psutil`` is no longer a dependency, as it has proven to make ``pytest-xdist`` installation in certain platforms and containers problematic. | ||
|
||
To those interested to continue to use ``psutil`` to detect the number of CPUs, the new ``pytest_xdist_auto_num_cpus`` hook can be used in the root ``conftest.py`` file of the project:: | ||
|
||
def pytest_xdist_auto_num_workers(config): | ||
import psutil | ||
return psutil.cpu_count(logical=False) |
This file contains 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
This file contains 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
This file contains 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