This commit is contained in:
Ashwin Bharambe 2025-08-06 11:00:06 -07:00
parent 4919fb0315
commit 2c0d6a4ce4
2 changed files with 9 additions and 26 deletions

View file

@ -36,25 +36,17 @@ def pytest_sessionstart(session):
# 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)
should_skip = (
hasattr(session.config, "skip_llama_stack_client_instantiation")
and session.config.skip_llama_stack_client_instantiation
)
print(f"config: {session.config}")
print(
"hasattr(session.config, 'skip_llama_stack_client_instantiation'):",
hasattr(session.config, "skip_llama_stack_client_instantiation"),
)
print(f"should_skip: {should_skip}")
if not should_skip:
print("instantiating llama_stack_client")
start_time = time.time()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
try:
session._llama_stack_client = instantiate_llama_stack_client(session)
print(f"llama_stack_client instantiated in {time.time() - start_time:.3f}s")
except Exception as e:
logger.error(f"Error instantiating llama_stack_client: {e}")
session._llama_stack_client = None
print(f"llama_stack_client instantiated in {time.time() - start_time:.3f}s")
def pytest_runtest_teardown(item):

View file

@ -1,9 +0,0 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
def pytest_configure(config):
config.skip_llama_stack_client_instantiation = True