Skip to content

Commit ad7f4fe

Browse files
committed
cleanup test
1 parent 9e50cdd commit ad7f4fe

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

conftest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
from vision_agents.core.edge.types import PcmData
1717
from vision_agents.core.stt.events import STTTranscriptEvent, STTErrorEvent
1818

19-
2019
load_dotenv()
2120

21+
2222
class STTSession:
2323
"""Helper class for testing STT implementations.
2424
@@ -65,6 +65,14 @@ async def wait_for_result(self, timeout: float = 30.0):
6565

6666
# Wait for an event
6767
await asyncio.wait_for(self._event.wait(), timeout=timeout)
68+
69+
def get_full_transcript(self) -> str:
70+
"""Get full transcription text from all transcript events.
71+
72+
Returns:
73+
Combined text from all transcripts
74+
"""
75+
return " ".join(t.text for t in self.transcripts)
6876

6977

7078
def get_assets_dir():
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pytest
2+
3+
from vision_agents.plugins import deepgram
4+
from conftest import STTSession
5+
6+
7+
class TestDeepgramSTT:
8+
"""Integration tests for Deepgram STT"""
9+
10+
@pytest.fixture
11+
async def stt(self):
12+
"""Create and manage Deepgram STT lifecycle"""
13+
stt = deepgram.STT()
14+
try:
15+
yield stt
16+
finally:
17+
await stt.close()
18+
19+
@pytest.mark.integration
20+
async def test_transcribe_mia_audio_48khz(self, stt, mia_audio_48khz):
21+
# Create session to collect transcripts and errors
22+
session = STTSession(stt)
23+
24+
# Process the audio
25+
await stt.process_audio(mia_audio_48khz)
26+
27+
# Wait for result
28+
await session.wait_for_result(timeout=30.0)
29+
assert not session.errors
30+
31+
# Verify transcript
32+
full_transcript = session.get_full_transcript()
33+
assert "forgotten treasures" in full_transcript.lower()
34+

0 commit comments

Comments
 (0)