fix: make VAD unit tests work with minimal dependencies
By mocking PyTorch and ZMQ and adding the Numpy dependency. ref: N25B-213
This commit is contained in:
@@ -18,6 +18,9 @@ def audio_out_socket():
|
||||
|
||||
@pytest.fixture
|
||||
def streaming(audio_in_socket, audio_out_socket):
|
||||
import torch
|
||||
|
||||
torch.hub.load.return_value = (..., ...) # Mock
|
||||
return Streaming(audio_in_socket, audio_out_socket)
|
||||
|
||||
|
||||
|
||||
@@ -33,3 +33,13 @@ def pytest_configure(config):
|
||||
mock_config_module.settings = MagicMock()
|
||||
|
||||
sys.modules["control_backend.core.config"] = mock_config_module
|
||||
|
||||
# --- Mock torch and zmq for VAD ---
|
||||
mock_torch = MagicMock()
|
||||
mock_zmq = MagicMock()
|
||||
mock_zmq.asyncio = mock_zmq
|
||||
|
||||
# In individual tests, these can be imported and the return values changed
|
||||
sys.modules["torch"] = mock_torch
|
||||
sys.modules["zmq"] = mock_zmq
|
||||
sys.modules["zmq.asyncio"] = mock_zmq.asyncio
|
||||
|
||||
Reference in New Issue
Block a user