Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion sdk/openai/azure-openai/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
DefaultAzureCredential as AsyncDefaultAzureCredential,
get_bearer_token_provider as get_bearer_token_provider_async,
)
from ci_tools.variables import in_ci


# for pytest.parametrize
GA = "2024-02-01"
PREVIEW = "2024-03-01-preview"
PREVIEW = "2024-05-01-preview"
LATEST = PREVIEW

AZURE = "azure"
Expand Down Expand Up @@ -65,8 +66,15 @@
ENV_OPENAI_TTS_MODEL = "tts-1"


def skip_openai_test(api_type) -> bool:
return in_ci() and "openai" in api_type and "tests-weekly" not in os.getenv("SYSTEM_DEFINITIONNAME", "")


@pytest.fixture
def client(api_type, api_version):
if skip_openai_test(api_type):
pytest.skip("Skipping openai tests - they only run on tests-weekly.")

if api_type == "azure":
client = openai.AzureOpenAI(
azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT),
Expand Down Expand Up @@ -100,6 +108,9 @@ def client(api_type, api_version):

@pytest.fixture
def client_async(api_type, api_version):
if skip_openai_test(api_type):
pytest.skip("Skipping openai tests - they only run on tests-weekly.")

if api_type == "azure":
client = openai.AsyncAzureOpenAI(
azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT),
Expand Down
Loading