Skip to content

Commit c88a4a3

Browse files
WEIFENG2333claudehappy-otter
committed
Add ASR model tests, auto-trigger integration CI
- Add TestASRModel: load SenseVoiceSmall, infer, transcribe alias, unload - Integration CI now auto-triggers on push to main, tags (v*), and PRs - 17 integration tests total (lifecycle + VAD + ASR + execute) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
1 parent 286a845 commit c88a4a3

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

.github/workflows/integration.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name: Integration Tests
22

33
on:
4-
workflow_dispatch: # Manual trigger from GitHub UI
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [main]
9+
workflow_dispatch:
510

611
jobs:
712
integration:

tests/test_integration.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,54 @@ def test_unload_vad(self, client):
161161
assert "vad" not in models["models"]
162162

163163

164+
class TestASRModel:
165+
"""Test with SenseVoiceSmall (~450MB)."""
166+
167+
def test_load_asr_model(self, client):
168+
"""Load SenseVoiceSmall ASR model."""
169+
result = client.load_model(
170+
model="iic/SenseVoiceSmall",
171+
name="asr",
172+
)
173+
assert result["status"] == "loaded"
174+
assert result["name"] == "asr"
175+
176+
def test_infer_asr(self, client, test_audio):
177+
"""ASR inference returns transcription text."""
178+
result = client.infer(input=test_audio, name="asr")
179+
180+
assert isinstance(result, list)
181+
assert len(result) > 0
182+
183+
first = result[0]
184+
assert "key" in first
185+
assert "text" in first
186+
assert isinstance(first["text"], str)
187+
assert len(first["text"]) > 0
188+
189+
def test_infer_asr_with_bytes(self, client, test_audio):
190+
"""ASR inference works with audio bytes input."""
191+
audio_bytes = Path(test_audio).read_bytes()
192+
result = client.infer(input_bytes=audio_bytes, name="asr")
193+
194+
assert isinstance(result, list)
195+
assert len(result) > 0
196+
assert "text" in result[0]
197+
198+
def test_transcribe_alias(self, client, test_audio):
199+
"""transcribe() works as alias for infer()."""
200+
result = client.transcribe(audio=test_audio, name="asr")
201+
202+
assert isinstance(result, list)
203+
assert len(result) > 0
204+
assert "text" in result[0]
205+
206+
def test_unload_asr(self, client):
207+
"""Unload ASR model."""
208+
result = client.unload_model(name="asr")
209+
assert result["status"] == "unloaded"
210+
211+
164212
class TestExecute:
165213
"""Test arbitrary code execution."""
166214

0 commit comments

Comments
 (0)