Skip to content

Commit 7ba2934

Browse files
DreamerLeader房建伟
andauthored
[BugFix]fix backend ut (vllm-project#9805)
### What this PR does / why we need it? This PR fixes the backend unit tests in `tests/ut/distributed/ascend_store/test_backend.py`. Recently, new attributes (such as `_lazy_init`, `_store_initialized`, `_is_a2`, `_registered_buffers`, and `_buffers_registered`) were added to `MooncakeBackend` and `MemcacheBackend` to support lazy initialization and buffer registration. Since the unit tests construct these backend instances using `__new__` (bypassing `__init__`), these attributes were missing on the mocked instances, causing unit test failures. This PR explicitly initializes these attributes on the mocked backend instances to fix the tests. - vLLM version: v0.20.2 - vLLM main: vllm-project/vllm@39910f2 --------- Signed-off-by: 房建伟 <fangjianwei@fangjianweideMacBook-Air.local> Co-authored-by: 房建伟 <fangjianwei@fangjianweideMacBook-Air.local>
1 parent 2577671 commit 7ba2934

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/ut/distributed/ascend_store/test_backend.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ def _make_backend(self):
256256
backend = MooncakeBackend.__new__(MooncakeBackend)
257257
backend.store = MagicMock()
258258
backend.config = MagicMock()
259+
backend._lazy_init = False
260+
backend._store_initialized = True
261+
backend._use_fabric_mem = False
259262
return backend
260263

261264
def test_exists(self):
@@ -413,6 +416,12 @@ def _make_backend(self):
413416
backend = MemcacheBackend.__new__(MemcacheBackend)
414417
backend.store = MagicMock()
415418
backend.local_rank = 0
419+
# Set internal state to avoid lazy init logic during tests
420+
backend._lazy_init = False
421+
backend._store_initialized = True
422+
backend._is_a2 = False
423+
backend._registered_buffers = None
424+
backend._buffers_registered = False
416425
return backend
417426

418427
def test_exists(self):

0 commit comments

Comments
 (0)