pytest-xdist
pytest-xdist copied to clipboard
Create Scheduler for Grouping Tests w/ Variable number of Workers
This pull request addresses Issue 1014. It adds a new scheduler that allows a user to add tests to arbitrary groups using the pytest mark xdist_custom. Using the mark a group name and number of workers to use for that group is specified. Groups are ran sequentially but tests in each group are ran in parallel with the given number of workers.
This pull request is a rough prototype. We aren't too familiar with pytest-xdist internals and we don't expect it is merge-able as is. However, we're hoping to open the conversation to see if there are improvements we can make to get this merged into pytest-xdist.
Since we wanted groups of tests to execute sequentially, we did not want to schedule tests from a pending group until after the currently running group completed all tests. We found that in order to obtain the status of the final test scheduled on a worker, we needed to send a shutdown signal to the worker. Because of this, between groups a shutdown signal is sent to each worker, and then workers are initialized again prior to scheduling the next group of tests.
We left the directory xdist-testing-ntop in as an example but will remove that and add proper tests.
Will add a changelog/1014.feature if this PR gains traction.