|
83 | 83 | "vllm.v1.attention", |
84 | 84 | "vllm.v1.attention.backend", |
85 | 85 | "vllm.v1.core", |
86 | | - "vllm.v1.core.block_pool", |
87 | 86 | "vllm.v1.core.kv_cache_manager", |
88 | 87 | "vllm.v1.core.kv_cache_utils", |
89 | 88 | "vllm.v1.core.sched", |
|
107 | 106 | _base_mod.KVConnectorRole = MagicMock() # type: ignore[attr-defined] |
108 | 107 | _base_mod.KVConnectorRole.SCHEDULER = "SCHEDULER" |
109 | 108 | _base_mod.KVConnectorRole.WORKER = "WORKER" |
110 | | -_base_mod.SupportsHMA = type("SupportsHMA", (), {}) # type: ignore[attr-defined] |
111 | 109 |
|
112 | 110 | _events_mod = sys.modules["vllm.distributed.kv_events"] |
113 | 111 | _events_mod.KVCacheEvent = type("KVCacheEvent", (), {}) # type: ignore[attr-defined] |
@@ -207,35 +205,8 @@ def _make_pkg(name, path=""): |
207 | 205 | ) |
208 | 206 | sys.modules["vllm_ascend.distributed.kv_transfer.kv_pool.ascend_store.backend"] = _backend_pkg |
209 | 207 |
|
210 | | -# Mirror the real backend/__init__.py entry points. The scheduler/worker resolve |
211 | | -# the backend class dynamically via ``importlib.import_module(path)``; tests that |
212 | | -# exercise those paths patch ``<module>.importlib`` locally (see |
213 | | -# test_pool_scheduler.py / test_pool_worker.py) so the backend resolves to a |
214 | | -# MagicMock. Do NOT register the backends in sys.modules or globally wrap |
215 | | -# import_module here: test_backend.py imports the real backend classes and also |
216 | | -# relies on ``mock.patch`` (which itself calls importlib.import_module) resolving |
217 | | -# those real modules. |
218 | | -_backend_module_paths = { |
219 | | - "mooncake": "vllm_ascend.distributed.kv_transfer.kv_pool.ascend_store.backend.mooncake_backend", |
220 | | - "memcache": "vllm_ascend.distributed.kv_transfer.kv_pool.ascend_store.backend.memcache_backend", |
221 | | - "yuanrong": "vllm_ascend.distributed.kv_transfer.kv_pool.ascend_store.backend.yuanrong_backend", |
222 | | -} |
223 | | -_backend_pkg.backend_map = { # type: ignore[attr-defined] |
224 | | - "mooncake": {"name": "MooncakeBackend", "path": _backend_module_paths["mooncake"]}, |
225 | | - "memcache": {"name": "MemcacheBackend", "path": _backend_module_paths["memcache"]}, |
226 | | - "yuanrong": {"name": "YuanrongBackend", "path": _backend_module_paths["yuanrong"]}, |
227 | | -} |
228 | | - |
229 | 208 | if "vllm_ascend.utils" not in sys.modules or not hasattr(sys.modules["vllm_ascend.utils"], "AscendDeviceType"): |
230 | 209 | _ascend_utils = MagicMock() |
231 | 210 | _ascend_utils.AscendDeviceType = MagicMock() |
232 | 211 | _ascend_utils.get_ascend_device_type = MagicMock() |
233 | 212 | sys.modules["vllm_ascend.utils"] = _ascend_utils |
234 | | - |
235 | | -# NOTE: vllm_ascend.{ascend_config, memcache_comm_fence} and their helpers |
236 | | -# (get_ascend_config, AttentionComputeStartGate, ...) are intentionally NOT |
237 | | -# mocked here. Doing so by mutating these real modules leaks into every other |
238 | | -# UT in the same pytest session (breaking test_ascend_config / test_platform, |
239 | | -# which collect after ascend_store and bind the polluted symbols at import). |
240 | | -# These helpers are mocked per-test, scoped to the ascend_store tests only, |
241 | | -# via the autouse fixture in tests/ut/conftest.py. |
0 commit comments