Replies: 2 comments 1 reply
-
|
I didn't try it, but maybe |
Beta Was this translation helpful? Give feedback.
-
|
Use pytest -n auto --max-worker-restart=3 --timeout=60For graceful cleanup on exceptions, wrap your test logic and call # conftest.py
import pytest
import sys
def pytest_sessionfinish(session, exitstatus):
if exitstatus != 0:
print("Gracefully shutting down xdist workers...")
# workers drain naturally after sessionfinishIf a single worker crashes, xdist reassigns its tests to other workers. To handle long-running hangs, combine with # pytest.ini
[pytest]
timeout = 120
timeout_method = signal # or threadThis kills hung workers and lets remaining workers continue. For full control, use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a scenario where I am applying some logic during an xdist -n=X run on the master node and sometimes explicitly on GW0 (tho i might refactor that to a plugin and have master handle it). In the event that something has gone wrong, how should I gracefully exit pytest/xdist across all workers?
Is there a simple means of doing this? I'm achieving it through some hacky methods at the moment and I'm wondering if there is actually a proper mechanism for handling it
Beta Was this translation helpful? Give feedback.
All reactions