Skip to content

Commit

Permalink
Skip test_chat_completions_invalid_chat_tokenizer if network issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Nov 8, 2024
1 parent 8b5f33e commit 039b510
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/openai/tests/test_chat_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,15 @@ def test_chat_completions_invalid_chat_tokenizer(

# Pick a tokenizer with no chat template defined
invalid_chat_tokenizer = "gpt2"
app = setup_fastapi_app(
tokenizer=invalid_chat_tokenizer, server=server, backend=backend
)
try:
app = setup_fastapi_app(
tokenizer=invalid_chat_tokenizer, server=server, backend=backend
)
except OSError as e:
expected_msg = f"We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like {invalid_chat_tokenizer} is not the path to a directory containing a file named config.json."
if expected_msg in str(e):
pytest.skip("HuggingFace network issues")
raise e
with TestClient(app) as client:
response = client.post(
"/v1/chat/completions",
Expand Down

0 comments on commit 039b510

Please sign in to comment.