From 625d39632aec3460cc924463cf5e853c0a36a6c0 Mon Sep 17 00:00:00 2001 From: Hermes Agent <127238744+teknium1@users.noreply.github.com> Date: Fri, 24 Jul 2026 12:04:18 -0700 Subject: [PATCH] test(wake): stub numpy in the fake-sherpa fixture for hermetic CI numpy is a lazy voice-extra dep absent from CI's hermetic env; the two engine process() tests imported it for real. Stub asarray/float32 in the fixture (verified against a blocked-numpy import, matching CI). --- tests/tools/test_wake_word.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/tools/test_wake_word.py b/tests/tools/test_wake_word.py index f70498a516e..afe74ea6f4b 100644 --- a/tests/tools/test_wake_word.py +++ b/tests/tools/test_wake_word.py @@ -244,6 +244,19 @@ def _install_fake_sherpa(monkeypatch, tmp_path): sherpa.text2token = _fake_text2token monkeypatch.setitem(sys.modules, "sherpa_onnx", sherpa) monkeypatch.setattr("tools.lazy_deps.ensure", lambda *a, **k: None) + + # numpy is an optional voice-extra dep, lazy-installed at runtime — CI's + # hermetic slices don't have it. process() only calls asarray(...)/32768, + # so a minimal stub keeps these tests runnable without the real package. + if "numpy" not in sys.modules: + class _FakeArr(list): + def __truediv__(self, other): + return self + + np_stub = types.ModuleType("numpy") + np_stub.float32 = "float32" + np_stub.asarray = lambda x, dtype=None: _FakeArr(x) + monkeypatch.setitem(sys.modules, "numpy", np_stub) return calls, model_dir