mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
compat-matrix: add PYTEST_K env var to scope pytest from the publisher
Operator escape hatch for first-time validation after a Claude Code CLI upgrade or a proxy-config change. Setting `PYTEST_K=anthropic and basic_messaging_non_streaming` (for example) narrows the matrix run to one cell, which is enough to confirm the worktree+uv+proxy+pytest plumbing without burning a full $2 in provider tokens. Cells the narrowed run doesn't touch are filled with `not_tested` by the matrix builder, so a PYTEST_K-narrowed run is structurally safe to publish — though in practice operators pair it with `--skip-publish` during validation.
This commit is contained in:
parent
449a44dba3
commit
e109eb80ae
1 changed files with 20 additions and 15 deletions
|
|
@ -642,24 +642,29 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
|
|||
"ANTHROPIC_AUTH_TOKEN": DEFAULT_PROXY_API_KEY,
|
||||
"COMPAT_RESULTS_PATH": str(args.results),
|
||||
}
|
||||
pytest_cmd = [
|
||||
"uv",
|
||||
"run",
|
||||
"pytest",
|
||||
"tests/claude_code/",
|
||||
"--ignore=tests/claude_code/_driver_unit_tests",
|
||||
"--ignore=tests/claude_code/_builder_unit_tests",
|
||||
"--ignore=tests/claude_code/_publisher_unit_tests",
|
||||
"--ignore=tests/claude_code/_pr_gate_unit_tests",
|
||||
]
|
||||
# Operator escape hatch: PYTEST_K narrows the run to a single
|
||||
# cell or feature for first-time validation after a CLI/proxy
|
||||
# upgrade. The matrix builder fills cells we didn't touch with
|
||||
# `not_tested`, so a PYTEST_K-narrowed run is safe to publish —
|
||||
# though in practice it's used with --skip-publish.
|
||||
pytest_k = os.environ.get("PYTEST_K", "").strip()
|
||||
if pytest_k:
|
||||
pytest_cmd.extend(["-k", pytest_k])
|
||||
print(f"PYTEST_K set; narrowing pytest to: {pytest_k}", flush=True)
|
||||
# Run pytest from inside the worktree so it picks up the
|
||||
# checked-out tag's test code (and its conftest hook), not the
|
||||
# current process's working directory.
|
||||
subprocess.run(
|
||||
[
|
||||
"uv",
|
||||
"run",
|
||||
"pytest",
|
||||
"tests/claude_code/",
|
||||
"--ignore=tests/claude_code/_driver_unit_tests",
|
||||
"--ignore=tests/claude_code/_builder_unit_tests",
|
||||
"--ignore=tests/claude_code/_publisher_unit_tests",
|
||||
"--ignore=tests/claude_code/_pr_gate_unit_tests",
|
||||
],
|
||||
env=env,
|
||||
cwd=args.worktree,
|
||||
check=False,
|
||||
)
|
||||
subprocess.run(pytest_cmd, env=env, cwd=args.worktree, check=False)
|
||||
|
||||
if args.skip_publish:
|
||||
print("skip-publish: not opening a PR", flush=True)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue