Files
vllm-omni/tests/helpers/fixtures/pytest_collection.py
T
2026-08-29 18:42:33 +08:00

31 lines
925 B
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
"""Pytest collection-phase hooks.
All ``pytest_collection_modifyitems`` policies live here so their order is
explicit. Add a named helper and call it from the hook; do not register a
second ``pytest_collection_modifyitems`` in another plugin.
"""
from __future__ import annotations
import pytest
def pytest_collection_modifyitems(config, items):
_pin_xdist_serial(config, items)
def _pin_xdist_serial(config, items):
"""Pin unmarked tests to one xdist worker.
Only tests explicitly marked ``pytest.mark.xdist`` run concurrently.
Others are pinned to a single xdist worker.
"""
if not config.pluginmanager.hasplugin("xdist"):
return
for item in items:
if not item.get_closest_marker("xdist"):
item.add_marker(pytest.mark.xdist_group(name="serial"))