Add psutil extra and introduce pytest_xdist_auto_num_workers hook

This makes using psutil optional and opens up the possibility of customization
through the pytest_xdist_auto_num_workers hook, making things like #477 possible.

Fix #585
This commit is contained in:
Bruno Oliveira
2020-08-24 15:17:43 -03:00
parent e469fc7b80
commit 607d8288d4
10 changed files with 88 additions and 21 deletions

View File

@@ -55,3 +55,13 @@ def pytest_xdist_node_collection_finished(node, ids):
@pytest.mark.firstresult
def pytest_xdist_make_scheduler(config, log):
""" return a node scheduler implementation """
@pytest.mark.firstresult
def pytest_xdist_auto_num_workers(config):
"""
Return the number of workers to spawn when ``--numprocesses=auto`` is given in the
command-line.
.. versionadded:: 2.1
"""