From ed3776645d4f310eb5c762864eb68d04f47333d3 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 14 Sep 2026 16:50:07 -0400 Subject: [PATCH] [Tests] Skip global GPU cleanup for parallel online diffusion tests (#7534) Signed-off-by: Nick Cao Co-authored-by: Codex --- .../diffusion/test_common_online.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/model_tests/diffusion/test_common_online.py b/tests/model_tests/diffusion/test_common_online.py index 9c7ef8a0a..65089e3ef 100644 --- a/tests/model_tests/diffusion/test_common_online.py +++ b/tests/model_tests/diffusion/test_common_online.py @@ -8,6 +8,7 @@ encoding) using tiny models. """ import pytest +from xdist import is_xdist_worker from tests.helpers.runtime import OmniServer, OnlineOmniClient from tests.model_tests.diffusion.case_filtering import get_parametrized_options @@ -30,6 +31,23 @@ from tests.model_tests.diffusion.task_runners import ( pytestmark = [pytest.mark.diffusion, pytest.mark.xdist] +@pytest.fixture(autouse=True) +def _disable_global_gpu_cleanup_for_parallel_workers( + request: pytest.FixtureRequest, + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Do not wait on total GPU usage while sibling xdist workers are active. + + ``cleanup_test_environment`` observes the whole device, not allocations + owned by the current worker. Waiting for the device to fall below its + global threshold therefore turns server teardown into a cross-worker + barrier when online tests run with xdist. ``OmniServer`` still tears down + its own subprocess tree; retain the broader cleanup for non-xdist runs. + """ + if is_xdist_worker(request): + monkeypatch.setattr("tests.helpers.runtime.cleanup_test_environment", lambda: None) + + @pytest.mark.parametrize( "model_name,accelerations,supported_tasks,check_multioutput,check_determinism", get_parametrized_options(DIFFUSION_TEST_SETTINGS, online=True),