fix: update sounddevice mocking in voice tests

This commit is contained in:
Paul Gauthier (aider) 2024-11-30 19:15:40 -08:00
parent 03c2964364
commit 9304b80b69

View file

@ -11,12 +11,13 @@ from aider.voice import SoundDeviceError, Voice
# Mock the entire sounddevice module # Mock the entire sounddevice module
@pytest.fixture @pytest.fixture
def mock_sounddevice(): def mock_sounddevice():
with patch("aider.voice.sounddevice") as mock_sd: with patch("sounddevice") as mock_sd:
mock_sd.query_devices.return_value = [ mock_sd.query_devices.return_value = [
{"name": "test_device", "max_input_channels": 2}, {"name": "test_device", "max_input_channels": 2},
{"name": "another_device", "max_input_channels": 1}, {"name": "another_device", "max_input_channels": 1},
] ]
yield mock_sd with patch.dict("sys.modules", {"sounddevice": mock_sd}):
yield mock_sd
@pytest.fixture @pytest.fixture