From e82794f48ff0812b01543f7c19c34eb0c5b3b1ee Mon Sep 17 00:00:00 2001 From: Xiaozhen Bi Date: Mon, 14 Sep 2026 03:48:53 -0700 Subject: [PATCH] [CI][Test] Mock CPU backend block sizes in kv_connector unit conftest (#56671) Signed-off-by: Xiaozhen Bi Co-authored-by: Claude Opus 5 --- tests/v1/kv_connector/unit/conftest.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/v1/kv_connector/unit/conftest.py diff --git a/tests/v1/kv_connector/unit/conftest.py b/tests/v1/kv_connector/unit/conftest.py new file mode 100644 index 0000000000..58c6e632d3 --- /dev/null +++ b/tests/v1/kv_connector/unit/conftest.py @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project +import pytest + +from vllm.platforms import current_platform + + +@pytest.fixture(autouse=True) +def _mock_cpu_backend_block_sizes(monkeypatch): + """Mock the CPU attention backend's kernel block-size declaration. + + Connector unit tests exercise transfer logic, never the attention + kernel, and hard-code block_size=16. On CPU-only machines + `CPUAttentionBackend` declares `MultipleOf(32)` (#54042), so every + worker construction would fail in `select_common_block_size` before + reaching the code under test. + """ + if not current_platform.is_cpu(): + return + from vllm.v1.attention.backend import MultipleOf + from vllm.v1.attention.backends.cpu_attn import CPUAttentionBackend + + monkeypatch.setattr( + CPUAttentionBackend, + "get_supported_kernel_block_sizes", + staticmethod(lambda: [MultipleOf(16)]), + )