diff --git a/tests/claude_code/conftest.py b/tests/claude_code/conftest.py index 567c24720ed..f58ab3d5897 100644 --- a/tests/claude_code/conftest.py +++ b/tests/claude_code/conftest.py @@ -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 diff --git a/tests/claude_code/cron_vm/run_daily.sh b/tests/claude_code/cron_vm/run_daily.sh index 50347d39b6c..85343a42f7a 100755 --- a/tests/claude_code/cron_vm/run_daily.sh +++ b/tests/claude_code/cron_vm/run_daily.sh @@ -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"