Skip to content

Commit 137ea7b

Browse files
committed
test: fix Qwen runtime unit mocks
1 parent d2585e5 commit 137ea7b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tests/test_llama.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,17 @@ def test_real_llama_embeddings(llama_cpp_model_path):
242242

243243
def test_kv_cache_seq_rm_returns_bool(monkeypatch):
244244
context = internals.LlamaContext.__new__(internals.LlamaContext)
245+
context._exit_stack = SimpleNamespace(close=lambda: None)
245246
context.memory = object()
246247
calls = []
247248

248249
def fake_llama_memory_seq_rm(memory, seq_id, p0, p1):
249250
calls.append((memory, seq_id, p0, p1))
250251
return True
251252

252-
monkeypatch.setattr(llama_cpp, "llama_memory_seq_rm", fake_llama_memory_seq_rm)
253+
monkeypatch.setattr(
254+
internals.llama_cpp, "llama_memory_seq_rm", fake_llama_memory_seq_rm
255+
)
253256

254257
assert context.kv_cache_seq_rm(-1, 4, -1) is True
255258
assert calls == [(context.memory, 0, 4, -1)]
@@ -270,6 +273,7 @@ def make_test_llama(kv_cache_seq_rm_return):
270273
llama._ctx = SimpleNamespace(
271274
kv_cache_seq_rm=Mock(return_value=kv_cache_seq_rm_return)
272275
)
276+
llama._stack = SimpleNamespace(close=lambda: None)
273277
llama._sampler = None
274278
llama.eval_tokens_seen = None
275279
llama.reset_calls = 0

0 commit comments

Comments
 (0)