Skip to content

Commit 72ac82c

Browse files
committed
tests: skip the Kokoro and Whisper suites without their extras
Both service modules raise ImportError when their optional dependency is absent, which fails collection for anyone — CI included — running without those extras installed. Guard each suite with importorskip so it skips instead.
1 parent d979450 commit 72ac82c

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

tests/test_kokoro_tts_language.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44
# SPDX-License-Identifier: BSD 2-Clause License
55
#
66

7-
"""Tests for Kokoro TTS language code mapping."""
7+
"""Tests for Kokoro TTS language code mapping.
88
9-
from pipecat.services.kokoro.tts import language_to_kokoro_language
10-
from pipecat.transcriptions.language import Language
9+
The service module is imported with ``pytest.importorskip`` so the suite is
10+
skipped rather than failing collection when the optional Kokoro dependencies
11+
aren't installed.
12+
"""
13+
14+
import pytest
15+
16+
# The service raises ImportError (not ModuleNotFoundError) when its extra is absent.
17+
pytest.importorskip("pipecat.services.kokoro.tts", exc_type=ImportError)
18+
19+
from pipecat.services.kokoro.tts import language_to_kokoro_language # noqa: E402
20+
from pipecat.transcriptions.language import Language # noqa: E402
1121

1222

1323
def test_kokoro_uses_espeak_names_not_iso_codes():

tests/test_whisper_stt_language.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
# SPDX-License-Identifier: BSD 2-Clause License
55
#
66

7-
"""Tests for Whisper STT model/language compatibility checking."""
7+
"""Tests for Whisper STT model/language compatibility checking.
8+
9+
The service module is imported with ``pytest.importorskip`` so the suite is
10+
skipped rather than failing collection when the optional Whisper dependencies
11+
aren't installed.
12+
"""
813

914
from unittest.mock import MagicMock, patch
1015

1116
import pytest
1217

13-
from pipecat.services.whisper.stt import WhisperSTTService
14-
from pipecat.transcriptions.language import Language
18+
# The service raises ImportError (not ModuleNotFoundError) when its extra is absent.
19+
pytest.importorskip("pipecat.services.whisper.stt", exc_type=ImportError)
20+
21+
from pipecat.services.whisper.stt import WhisperSTTService # noqa: E402
22+
from pipecat.transcriptions.language import Language # noqa: E402
1523

1624

1725
def _build(supported, **settings):

0 commit comments

Comments
 (0)