File tree Expand file tree Collapse file tree 2 files changed +7
-19
lines changed
Expand file tree Collapse file tree 2 files changed +7
-19
lines changed Original file line number Diff line number Diff line change 99import platform
1010import textwrap
1111import time
12- import warnings
1312
1413import pytest
1514from dotenv import load_dotenv
1615
1716from llama_stack .log import get_logger
1817
19- from .fixtures .common import instantiate_llama_stack_client
20-
2118logger = get_logger (__name__ , category = "tests" )
2219
2320
@@ -34,20 +31,6 @@ def pytest_sessionstart(session):
3431 # stop macOS from complaining about duplicate OpenMP libraries
3532 os .environ ["KMP_DUPLICATE_LIB_OK" ] = "TRUE"
3633
37- # pull client instantiation to session start so all the complex logs during initialization
38- # don't clobber the test one-liner outputs
39- print ("instantiating llama_stack_client" )
40- start_time = time .time ()
41- with warnings .catch_warnings ():
42- warnings .filterwarnings ("ignore" , category = DeprecationWarning )
43-
44- try :
45- session ._llama_stack_client = instantiate_llama_stack_client (session )
46- except Exception as e :
47- logger .error (f"Error instantiating llama_stack_client: { e } " )
48- session ._llama_stack_client = None
49- print (f"llama_stack_client instantiated in { time .time () - start_time :.3f} s" )
50-
5134
5235def pytest_runtest_teardown (item ):
5336 # Check if the test actually ran and passed or failed, but was not skipped or an expected failure (xfail)
Original file line number Diff line number Diff line change @@ -178,8 +178,13 @@ def skip_if_no_model(request):
178178
179179@pytest .fixture (scope = "session" )
180180def llama_stack_client (request ):
181- client = request .session ._llama_stack_client
182- assert client is not None , "llama_stack_client not found in session cache"
181+ # ideally, we could do this in session start given all the complex logs during initialization
182+ # don't clobber the test one-liner outputs. however, this also means all tests in a sub-directory
183+ # would be forced to use llama_stack_client, which is not what we want.
184+ print ("\n instantiating llama_stack_client" )
185+ start_time = time .time ()
186+ client = instantiate_llama_stack_client (request .session )
187+ print (f"llama_stack_client instantiated in { time .time () - start_time :.3f} s" )
183188 return client
184189
185190
You can’t perform that action at this time.
0 commit comments