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:
20
test/integration/test_microphone_utils.py
Normal file
20
test/integration/test_microphone_utils.py
Normal 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
|
||||
Reference in New Issue
Block a user