diff --git a/tests/test_client.py b/tests/test_client.py index e6209f2..f4635ad 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,6 +1,7 @@ import pytest from elevenlabs import generate, voices, Voice, VoiceSettings, play, stream +from .utils import IN_GITHUB def test_voices() -> None: @@ -15,7 +16,8 @@ def test_generate() -> None: settings=VoiceSettings(stability=0.71, similarity_boost=0.5, style=0.0, use_speaker_boost=True) ) ) - play(audio) # type: ignore + if not IN_GITHUB: + play(audio) # type: ignore def test_generate_stream() -> None: @@ -29,8 +31,9 @@ def text_stream(): model="eleven_monolingual_v1", stream=True ) - - stream(audio_stream) # type: ignore + + if not IN_GITHUB: + stream(audio_stream) # type: ignore def test_generate_with_settings() -> None: @@ -44,4 +47,5 @@ def test_generate_with_settings() -> None: ) ) - play(audio) # type: ignore + if not IN_GITHUB: + play(audio) # type: ignore diff --git a/tests/test_voice.py b/tests/test_voice.py index 8e9b83d..8e04093 100644 --- a/tests/test_voice.py +++ b/tests/test_voice.py @@ -1,8 +1,6 @@ from elevenlabs.client import ElevenLabs from elevenlabs.types.voice_response import VoiceResponse -from .utils import use_play - -import pytest +from .utils import IN_GITHUB def test_voice_from_id(): @@ -58,7 +56,8 @@ def test_voice_clone(): client.voices.delete(voice.voice_id) - play(audio) + if not IN_GITHUB: + play(audio) def test_voice_design(): @@ -81,7 +80,9 @@ def test_voice_design(): ) assert isinstance(audio, bytes) and len(audio) > 0 - play(audio) + + if not IN_GITHUB: + play(audio) diff --git a/tests/utils.py b/tests/utils.py index 19e4744..cff305b 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -7,6 +7,7 @@ import requests # type: ignore use_play = "PLAY" in os.environ +IN_GITHUB = "GITHUB_ACTIONS" in os.environ @contextmanager