[CI][Test] Mock CPU backend block sizes in kv_connector unit conftest (#56671)
Signed-off-by: Xiaozhen Bi <xiaozhen.bi@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Xiaozhen Bi committed
Sep 14, 2026 at 03:48 UTC
e82794f48ff0812b01543f7c19c34eb0c5b3b1ee
1 file changed
+27
tests/v1/kv_connector/unit/conftest.py
new
+27
@@ -0,0 +1,27 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+import pytest
4
+
5
+from vllm.platforms import current_platform
6
+
7
+
8
+@pytest.fixture(autouse=True)
9
+def _mock_cpu_backend_block_sizes(monkeypatch):
10
+ """Mock the CPU attention backend's kernel block-size declaration.
11
+
12
+ Connector unit tests exercise transfer logic, never the attention
13
+ kernel, and hard-code block_size=16. On CPU-only machines
14
+ `CPUAttentionBackend` declares `MultipleOf(32)` (#54042), so every
15
+ worker construction would fail in `select_common_block_size` before
16
+ reaching the code under test.
17
+ """
18
+ if not current_platform.is_cpu():
19
+ return
20
+ from vllm.v1.attention.backend import MultipleOf
21
+ from vllm.v1.attention.backends.cpu_attn import CPUAttentionBackend
22
+
23
+ monkeypatch.setattr(
24
+ CPUAttentionBackend,
25
+ "get_supported_kernel_block_sizes",
26
+ staticmethod(lambda: [MultipleOf(16)]),
27
+ )