Skip to content

Commit c473244

Browse files
xitzhangXiting Zhangscbedd
authored
[VoiceLive] Add tests (#42797)
* [VoiceLive] Add tests * modify tests * update test * update env vars * update path of preparer * remove live test tag * update async config * update test resources * update * update * update models * update * update * update * update tests.yml construction * update assets * update mark * update pylint --------- Co-authored-by: Xiting Zhang <[email protected]> Co-authored-by: Scott Beddall <[email protected]>
1 parent a7ab0d2 commit c473244

File tree

9 files changed

+1354
-13
lines changed

9 files changed

+1354
-13
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"AssetsRepo": "Azure/azure-sdk-assets",
3+
"AssetsRepoPrefixPath": "python",
4+
"TagPrefix": "python/ai/azure-ai-voicelive",
5+
"Tag": "python/ai/azure-ai-voicelive_9c84c5d9c2"
6+
}

sdk/ai/azure-ai-voicelive/azure/ai/voicelive/aio/_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ def __init__(
637637
self._endpoint = endpoint
638638
raw_scopes = kwargs.pop(
639639
"credential_scopes",
640-
["https://cognitiveservices.azure.com/.default"],
640+
["https://ai.azure.com/.default"],
641641
)
642642
if isinstance(raw_scopes, str):
643643
self.__credential_scopes = [raw_scopes]

sdk/ai/azure-ai-voicelive/dev_requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ python-dotenv
55
isodate
66
websockets
77
pyaudio; platform_python_implementation == 'CPython' and python_version < '3.13'
8-
azure.identity
8+
azure.identity
9+
pytest-rerunfailures>=13.0
10+
pytest-asyncio
11+
soundfile

sdk/ai/azure-ai-voicelive/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ exclude = [
7272

7373
[tool.setuptools.package-data]
7474
pytyped = ["py.typed"]
75+
76+
[tool.pytest.ini_options]
77+
asyncio_default_fixture_loop_scope = "function"
78+
asyncio_mode = "auto"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
extends:
2+
template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
3+
parameters:
4+
BuildTargetingString: 'azure-ai-voicelive'
5+
JobName: chat
6+
ServiceDirectory: ai
7+
TestResourceDirectories:
8+
- ai/azure-ai-voicelive
9+
EnvVars:
10+
AZURE_TEST_RUN_LIVE: 'true'
11+
AZURE_TEST_USE_CLI_AUTH: 'true'
12+
VOICELIVE_OPENAI_ENDPOINT: $(VoiceLiveOpenAIEndpoint)
13+
VOICELIVE_OPENAI_API_KEY: $(VoiceLiveOpenAIApiKey)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
Pytest configuration for Azure AI Voice Live SDK tests.
3+
"""
4+
5+
import pytest
6+
import os
7+
import base64
8+
from devtools_testutils import (
9+
test_proxy,
10+
is_live
11+
)
12+
13+
from pathlib import Path
14+
15+
def pytest_runtest_setup(item):
16+
is_live_only_test_marked = bool([mark for mark in item.iter_markers(name="live_test_only")])
17+
if is_live_only_test_marked:
18+
if not is_live():
19+
pytest.skip("live test only")
20+
21+
is_playback_test_marked = bool([mark for mark in item.iter_markers(name="playback_test_only")])
22+
if is_playback_test_marked:
23+
if is_live():
24+
pytest.skip("playback test only")
25+
26+
@pytest.fixture
27+
def test_data_dir() -> Path:
28+
return Path(__file__).parent / "data"
29+
30+
@pytest.fixture(scope="session", autouse=True)
31+
def start_proxy(test_proxy):
32+
return

0 commit comments

Comments
 (0)