From a01596a5fefdcde32d9ab4486a453d667d9c1fdb Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Mon, 18 Aug 2025 18:50:10 -0400 Subject: [PATCH] skip openai_client tests if no server is running --- tests/integration/files/test_files.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/integration/files/test_files.py b/tests/integration/files/test_files.py index c47e47f0c..545ed08cf 100644 --- a/tests/integration/files/test_files.py +++ b/tests/integration/files/test_files.py @@ -10,6 +10,7 @@ from unittest.mock import patch import pytest from llama_stack.core.datatypes import User +from llama_stack.core.library_client import LlamaStackAsLibraryClient # a fixture to skip all these tests if a files provider is not available @@ -19,7 +20,20 @@ def skip_if_no_files_provider(llama_stack_client): pytest.skip("No files providers found") -def test_openai_client_basic_operations(openai_client): +@pytest.fixture(scope="session") +def skip_if_no_server_running(llama_stack_client): + """ + Skip test if no server is running. + + We use the llama_stack_client to tell if a server was started or not. + + We use this with openai_client because it relies on a running server. + """ + if isinstance(llama_stack_client, LlamaStackAsLibraryClient): + pytest.skip("No server running") + + +def test_openai_client_basic_operations(openai_client, skip_if_no_server_running): """Test basic file operations through OpenAI client.""" from openai import NotFoundError