mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-12 20:12:33 +00:00
Added an import
This commit is contained in:
parent
deaccfcb4b
commit
bcdca4d9a5
1 changed files with 18 additions and 8 deletions
|
|
@ -87,7 +87,9 @@ def pytest_configure(config):
|
|||
suite = config.getoption("--suite")
|
||||
if suite:
|
||||
if suite not in SUITE_DEFINITIONS:
|
||||
raise pytest.UsageError(f"Unknown suite: {suite}. Available: {', '.join(sorted(SUITE_DEFINITIONS.keys()))}")
|
||||
raise pytest.UsageError(
|
||||
f"Unknown suite: {suite}. Available: {', '.join(sorted(SUITE_DEFINITIONS.keys()))}"
|
||||
)
|
||||
|
||||
# Apply setups (global parameterizations): env + defaults
|
||||
setup = config.getoption("--setup")
|
||||
|
|
@ -125,7 +127,9 @@ def pytest_addoption(parser):
|
|||
"""
|
||||
),
|
||||
)
|
||||
parser.addoption("--env", action="append", help="Set environment variables, e.g. --env KEY=value")
|
||||
parser.addoption(
|
||||
"--env", action="append", help="Set environment variables, e.g. --env KEY=value"
|
||||
)
|
||||
parser.addoption(
|
||||
"--text-model",
|
||||
help="comma-separated list of text models. Fixture name: text_model_id",
|
||||
|
|
@ -165,9 +169,7 @@ def pytest_addoption(parser):
|
|||
)
|
||||
|
||||
available_suites = ", ".join(sorted(SUITE_DEFINITIONS.keys()))
|
||||
suite_help = (
|
||||
f"Single test suite to run (narrows collection). Available: {available_suites}. Example: --suite=responses"
|
||||
)
|
||||
suite_help = f"Single test suite to run (narrows collection). Available: {available_suites}. Example: --suite=responses"
|
||||
parser.addoption("--suite", help=suite_help)
|
||||
|
||||
# Global setups for any suite
|
||||
|
|
@ -239,7 +241,11 @@ def pytest_generate_tests(metafunc):
|
|||
|
||||
# Generate test IDs
|
||||
test_ids = []
|
||||
non_empty_params = [(i, values) for i, values in enumerate(param_values.values()) if values[0] is not None]
|
||||
non_empty_params = [
|
||||
(i, values)
|
||||
for i, values in enumerate(param_values.values())
|
||||
if values[0] is not None
|
||||
]
|
||||
|
||||
# Get actual function parameters using inspect
|
||||
test_func_params = set(inspect.signature(metafunc.function).parameters.keys())
|
||||
|
|
@ -256,7 +262,9 @@ def pytest_generate_tests(metafunc):
|
|||
if parts:
|
||||
test_ids.append(":".join(parts))
|
||||
|
||||
metafunc.parametrize(params, value_combinations, scope="session", ids=test_ids if test_ids else None)
|
||||
metafunc.parametrize(
|
||||
params, value_combinations, scope="session", ids=test_ids if test_ids else None
|
||||
)
|
||||
|
||||
|
||||
pytest_plugins = ["tests.integration.fixtures.common"]
|
||||
|
|
@ -269,7 +277,9 @@ def pytest_ignore_collect(path: str, config: pytest.Config) -> bool:
|
|||
return False
|
||||
|
||||
sobj = SUITE_DEFINITIONS.get(suite)
|
||||
roots: list[str] = sobj.get("roots", []) if isinstance(sobj, dict) else getattr(sobj, "roots", [])
|
||||
roots: list[str] = (
|
||||
sobj.get("roots", []) if isinstance(sobj, dict) else getattr(sobj, "roots", [])
|
||||
)
|
||||
if not roots:
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue