mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-15 04:22:38 +00:00
Merge branch 'main' into dead_code_removal
This commit is contained in:
commit
9886520b40
927 changed files with 171924 additions and 102933 deletions
|
|
@ -36,6 +36,24 @@ def pytest_sessionstart(session):
|
|||
os.environ["LLAMA_STACK_TEST_INFERENCE_MODE"] = "replay"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _track_test_context(request):
|
||||
"""Automatically track current test context for isolated recordings.
|
||||
|
||||
This fixture runs for every test and stores the test's nodeid in a contextvar
|
||||
that the recording system can access to determine which subdirectory to use.
|
||||
"""
|
||||
from llama_stack.testing.inference_recorder import _test_context
|
||||
|
||||
# Store the test nodeid (e.g., "tests/integration/responses/test_basic.py::test_foo[params]")
|
||||
token = _test_context.set(request.node.nodeid)
|
||||
|
||||
yield
|
||||
|
||||
# Cleanup
|
||||
_test_context.reset(token)
|
||||
|
||||
|
||||
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)
|
||||
|
|
@ -141,8 +159,8 @@ def pytest_addoption(parser):
|
|||
|
||||
parser.addoption(
|
||||
"--inference-mode",
|
||||
help="Inference mode: { record, replay, live } (default: replay)",
|
||||
choices=["record", "replay", "live"],
|
||||
help="Inference mode: { record, replay, live, record-if-missing } (default: replay)",
|
||||
choices=["record", "replay", "live", "record-if-missing"],
|
||||
default="replay",
|
||||
)
|
||||
parser.addoption(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue