diff --git a/.circleci/config.yml b/.circleci/config.yml index 9652a78ea51..16819981345 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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" \ diff --git a/tests/claude_code/conftest.py b/tests/claude_code/conftest.py index fe827c2bb22..91d7447d026 100644 --- a/tests/claude_code/conftest.py +++ b/tests/claude_code/conftest.py @@ -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.