test: unit test mock PyAudio, integration test use real

Make unit tests use a mock version of PyAudio, while making integration tests using the real version. If no real microphone is available, these integration tests are skipped.

ref: N25B-119
This commit is contained in:
Twirre Meulenbelt
2025-10-22 13:27:35 +02:00
parent 1e3e077029
commit f8db719bfa
3 changed files with 186 additions and 91 deletions

View File

@@ -0,0 +1,20 @@
import pyaudio
import pytest
from common.microphone_utils import MicrophoneUtils
@pytest.fixture
def pyaudio_instance():
audio = pyaudio.PyAudio()
try:
audio.get_default_input_device_info()
return audio
except IOError:
pytest.skip("No microphone available to test with.")
class TestAudioIntegration(MicrophoneUtils):
"""Run shared audio behavior tests with the mock implementation."""
pass