test: launch_engine_first gives the runner a Qwen catalog (a bare Mock answered 'DeepSeek' to the 0.2.4 multi-file question and skipped the engine step); the launch code was right

This commit is contained in:
Niko1221 committed 2026-10-24 15:25:07 +02:00
1 parent 54768d25b1
commit dc2c4229e9
1 file changed
+10 -2
+10 -2
View File
@@ -24,6 +24,14 @@ UNUSABLE = {"usable": False, "engine": None, "notice": "No engine for this PC wa
"The app never downloads an engine while it starts or serves."}
def qwen_catalog():
"""A catalog stand-in for a Qwen model: since 0.2.4 the runner asks it whether the family is DeepSeek (which has its own engine and skips this step);
a bare Mock answers yes to everything."""
cat = mock.Mock()
cat.strata.multi_family.return_value = False
return cat
class FakeProc:
def __init__(self, events: list[dict], code: int = 0):
self.stdout = iter(json.dumps(e) + "\n" for e in events)
@@ -42,7 +50,7 @@ def update_events(status: str, note: str = "", code: int = 0) -> list[dict]:
def runner(spawned: list) -> Runner:
r = Runner(S.LaunchSettings(family="qwen", model="Q2_0", context=32768), catalog=mock.Mock(), emit=lambda e: None)
r = Runner(S.LaunchSettings(family="qwen", model="Q2_0", context=32768), catalog=qwen_catalog(), emit=lambda e: None)
r.check_cancel = lambda: None
return r
@@ -58,7 +66,7 @@ class EngineBeforeModel(unittest.TestCase):
"""ensure_engine() like run_ensure, returning (spawns, error or None, the runner with .events)."""
spawns: list = []
seen: list = []
r = Runner(S.LaunchSettings(family="qwen", model="Q2_0", context=32768), catalog=mock.Mock(), emit=seen.append,
r = Runner(S.LaunchSettings(family="qwen", model="Q2_0", context=32768), catalog=qwen_catalog(), emit=seen.append,
confirm=confirm, assume_yes=assume_yes)
r.events = seen
r.check_cancel = lambda: None