39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
This program has been developed by students from the bachelor Computer Science at Utrecht
|
|
University within the Software Project course.
|
|
© Copyright Utrecht University (Department of Information and Computing Sciences)
|
|
"""
|
|
|
|
import pyaudio
|
|
|
|
import pytest
|
|
|
|
from common.microphone_utils import MicrophoneUtils
|
|
|
|
|
|
@pytest.fixture
|
|
def pyaudio_instance():
|
|
"""
|
|
A pytest fixture that provides an initialized PyAudio instance for tests
|
|
requiring microphone access.
|
|
|
|
It first initializes PyAudio. If a default input device (microphone) is not
|
|
found, the test is skipped to avoid failures in environments
|
|
without a mic.
|
|
|
|
:return: An initialized PyAudio instance.
|
|
:rtype: pyaudio.PyAudio
|
|
"""
|
|
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
|