mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
fix: clear compat collector per session and set LITELLM_MASTER_KEY for cron proxy
- Add pytest_sessionstart hook in tests/claude_code/conftest.py that
clears the module-level _COLLECTOR so results don't leak across
pytest.main() invocations within the same process.
- Export LITELLM_MASTER_KEY=${PROXY_API_KEY} when launching the cron
VM proxy so the auth token the tests send actually matches what
the proxy expects.
This commit is contained in:
parent
96d90ac7bd
commit
597d99b026
2 changed files with 12 additions and 1 deletions
|
|
@ -146,6 +146,17 @@ def pytest_runtest_makereport(item, call):
|
|||
)
|
||||
|
||||
|
||||
def pytest_sessionstart(session):
|
||||
"""Clear collected results at the start of each session.
|
||||
|
||||
The `_COLLECTOR` is a module-level singleton, so it survives across
|
||||
`pytest.main()` invocations within the same Python process. Without
|
||||
this reset, results from a prior session would leak into the next
|
||||
run's `compat-results.json` artifact.
|
||||
"""
|
||||
_COLLECTOR.items.clear()
|
||||
|
||||
|
||||
def pytest_sessionfinish(session, exitstatus):
|
||||
"""Write the structured results artifact at end of session."""
|
||||
artifact_path = os.environ.get(RESULTS_ARTIFACT_ENV) or DEFAULT_ARTIFACT_PATH
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ log "starting proxy on :${PROXY_PORT}"
|
|||
# SIGTERM the whole tree by passing the pgid as a negative pid. We
|
||||
# write that pid to a file so cleanup() doesn't need to remember a
|
||||
# variable that might be stale by the time the trap fires.
|
||||
setsid bash -c '
|
||||
setsid env LITELLM_MASTER_KEY="${PROXY_API_KEY}" bash -c '
|
||||
echo "$$" > "$0"
|
||||
cd "$1"
|
||||
exec "$2" run litellm --config "$3" --port "$4"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue