fix(multimodal): 冻结推理环境并隔离迟到导入错误

This commit is contained in:
2026-09-05 02:09:15 +08:00
parent 6ee6cd7d73
commit cb1c6dfcf5
8 changed files with 38 additions and 12 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ def test_local_model_missing_is_explicit():
def test_cancel_reaps_active_model_process(monkeypatch):
import app.local_models.runtime as module
monkeypatch.setattr(module,'read_state',lambda key:{'status':'installed'})
monkeypatch.setattr(module,'interpreter',lambda:Path(sys.executable))
monkeypatch.setattr(module,'interpreter',lambda *_:Path(sys.executable))
class Input:
def write(self, value):
request = json.loads(value)
@@ -92,7 +92,7 @@ def test_subprocess_fallback_runs_and_reaps_real_worker(monkeypatch, tmp_path, c
import app.local_models.process as process_module
monkeypatch.setattr(module, 'read_state', lambda key: {'status': 'installed'})
monkeypatch.setattr(module, 'interpreter', lambda: Path(sys.executable))
monkeypatch.setattr(module, 'interpreter', lambda *_: Path(sys.executable))
worker = tmp_path / 'worker.py'
worker.write_text(
'import json,sys,time\n'