[Tests] Disable retries and use context manager for openai client (#7565)

This commit is contained in:
Nick Hill
2024-08-26 21:33:17 -07:00
committed by GitHub
parent 2eedede875
commit 39178c7fbc
15 changed files with 130 additions and 93 deletions

View File

@@ -8,6 +8,7 @@ from typing import Dict, List, Optional
import jsonschema
import openai # use the official client for correctness check
import pytest
import pytest_asyncio
# downloading lora to test lora requests
from huggingface_hub import snapshot_download
from openai import BadRequestError
@@ -89,11 +90,17 @@ def default_server_args(zephyr_lora_files, zephyr_lora_added_tokens_files,
@pytest.fixture(scope="module",
params=["", "--disable-frontend-multiprocessing"])
def client(default_server_args, request):
def server(default_server_args, request):
if request.param:
default_server_args.append(request.param)
with RemoteOpenAIServer(MODEL_NAME, default_server_args) as remote_server:
yield remote_server.get_async_client()
yield remote_server
@pytest_asyncio.fixture
async def client(server):
async with server.get_async_client() as async_client:
yield async_client
@pytest.mark.asyncio