chore(misc): make tests and starter faster

This commit is contained in:
Ashwin Bharambe 2025-08-05 13:57:15 -07:00
parent ea46f74092
commit 2b4e88a3de
19 changed files with 2860 additions and 1660 deletions

View file

@ -9,12 +9,15 @@ import os
import platform
import textwrap
import time
import warnings
import pytest
from dotenv import load_dotenv
from llama_stack.log import get_logger
from .fixtures.common import instantiate_llama_stack_client
logger = get_logger(__name__, category="tests")
@ -27,6 +30,20 @@ def pytest_runtest_makereport(item, call):
item.was_xfail = getattr(report, "wasxfail", False)
def pytest_sessionstart(session):
# stop macOS from complaining about duplicate OpenMP libraries
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
# pull client instantiation to session start so all the complex logs during initialization
# don't clobber the test one-liner outputs
print("instantiating llama_stack_client")
start_time = time.time()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
session._llama_stack_client = instantiate_llama_stack_client(session)
print(f"llama_stack_client instantiated in {time.time() - start_time:.3f}s")
def pytest_runtest_teardown(item):
# Check if the test actually ran and passed or failed, but was not skipped or an expected failure (xfail)
outcome = getattr(item, "execution_outcome", None)