mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(compat-matrix): merge sessionstart hooks + pass Vertex env to PR-gate proxy
- conftest: combine the two pytest_sessionstart definitions so stale shard cleanup actually runs (the second def previously shadowed the first, leaving compat-results.json.shards/ from prior sessions in place and polluting the merged artifact). - circleci: forward VERTEXAI_PROJECT and VERTEXAI_LOCATION into the compat-proxy container so test_config.yaml's os.environ refs for the Vertex AI routes resolve in the PR gate. Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
82e3e73bfd
commit
a1c4f0fc12
2 changed files with 19 additions and 19 deletions
|
|
@ -2324,6 +2324,8 @@ jobs:
|
|||
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
|
||||
-e AWS_REGION_NAME="us-east-1" \
|
||||
-e VERTEXAI_CREDENTIALS=$VERTEXAI_CREDENTIALS \
|
||||
-e VERTEXAI_PROJECT=$VERTEXAI_PROJECT \
|
||||
-e VERTEXAI_LOCATION=$VERTEXAI_LOCATION \
|
||||
-e AZURE_FOUNDRY_API_KEY=$AZURE_FOUNDRY_API_KEY \
|
||||
-e AZURE_FOUNDRY_API_BASE=$AZURE_FOUNDRY_API_BASE \
|
||||
-e LITELLM_LOCAL_ANTHROPIC_BETA_HEADERS="True" \
|
||||
|
|
|
|||
|
|
@ -367,17 +367,26 @@ def _print_rate_limit_summary(summary: Dict[str, Any]) -> None:
|
|||
|
||||
|
||||
def pytest_sessionstart(session):
|
||||
"""Clear stale per-worker shards from any prior session.
|
||||
"""Reset per-session state before tests run.
|
||||
|
||||
Without this, a previous run's shard directory leaks into the next
|
||||
`pytest_sessionfinish` merge — yielding a `compat-results.json`
|
||||
that includes results from runs that aren't part of the current
|
||||
session, and a misleading rate-limit summary that re-flags
|
||||
failures the user already saw and addressed.
|
||||
Two responsibilities:
|
||||
|
||||
Only the controller (non-xdist-worker) clears; workers must not
|
||||
race the controller while it's wiping the directory.
|
||||
1. Clear the module-level `_COLLECTOR` singleton, which 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.
|
||||
|
||||
2. Remove stale per-worker shards from any prior session. Without
|
||||
this, a previous run's shard directory leaks into the next
|
||||
`pytest_sessionfinish` merge — yielding a `compat-results.json`
|
||||
that includes results from runs that aren't part of the current
|
||||
session, and a misleading rate-limit summary that re-flags
|
||||
failures the user already saw and addressed. Only the
|
||||
controller (non-xdist-worker) clears; workers must not race
|
||||
the controller while it's wiping the directory.
|
||||
"""
|
||||
_COLLECTOR.items.clear()
|
||||
|
||||
if _is_xdist_worker(session):
|
||||
return
|
||||
artifact_path = Path(os.environ.get(RESULTS_ARTIFACT_ENV) or DEFAULT_ARTIFACT_PATH)
|
||||
|
|
@ -395,17 +404,6 @@ def pytest_sessionstart(session):
|
|||
continue
|
||||
|
||||
|
||||
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 per-process results shard, then merge if we're the controller.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue