When running the following test file
def test_1():
assert True
def test_2():
import time
time.sleep(5)
assert True
with (uses features from pytest 9)
pytest -n1 --dist=loadgroup -o faulthandler_timeout=1 -o faulthandler_exit_on_timeout=true testing/test_timeout.py
test execution hangs with
replacing crashed worker gw0
collecting: 1/2 workers
collecting: 1/2 workers
2 workers [2 items]
When using another test distribution algorithm, test execution does not hang.
The issue is that
|
# Made uncompleted work unit available again |
|
self.workqueue.update(workload) |
adds the complete workload to the queue, including the completed work.
Later in
|
nodeids_indexes = [ |
|
worker_collection.index(nodeid) |
|
for nodeid, completed in work_unit.items() |
|
if not completed |
|
] |
completed work items are dropped so that
nodeids_indexes is empty.
Finally, the process hangs in
|
self.nextitem_index = self.torun.get() |
When running the following test file
with (uses features from pytest 9)
test execution hangs with
When using another test distribution algorithm, test execution does not hang.
The issue is that
pytest-xdist/src/xdist/scheduler/loadscope.py
Lines 199 to 200 in 8fed345
adds the complete workload to the queue, including the completed work.
Later in
pytest-xdist/src/xdist/scheduler/loadscope.py
Lines 276 to 280 in 8fed345
completed work items are dropped so that
nodeids_indexesis empty.Finally, the process hangs in
pytest-xdist/src/xdist/remote.py
Line 204 in 8fed345