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).
This commit is contained in:
parent
5e11476024
commit
e3cd3a9cc1
@ -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
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user