From 9fd7f753589a5af9f70b9d4156f13c15ffb7796e Mon Sep 17 00:00:00 2001 From: moe-berri Date: Sun, 8 Nov 2026 16:39:04 +0800 Subject: [PATCH] fix(ci): isolate integration coverage from nested test runs --- .circleci/scripts/run_integration.sh | 6 +++--- tests/integration/run.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/scripts/run_integration.sh b/.circleci/scripts/run_integration.sh index 8ce4476f156..0aa159a9c36 100644 --- a/.circleci/scripts/run_integration.sh +++ b/.circleci/scripts/run_integration.sh @@ -248,7 +248,7 @@ shared_services=() worker_coverage=() pytest_coverage=() if [ "$suite" = database ]; then - pytest_coverage=("PYTEST_ADDOPTS=--cov=litellm --cov-report=xml:$PWD/$results/coverage.xml") + pytest_coverage=(--coverage) fi if [ "$isolated_workers" = false ]; then shared_services=( @@ -263,7 +263,7 @@ fi env -i PATH="$PATH" HOME="$HOME" PYTHONPATH="$PYTHONPATH" \ INTEGRATION_RUN_ID="$integration_identity" \ DATABASE_URL="$DATABASE_URL" \ - "${shared_services[@]}" "${worker_coverage[@]}" "${pytest_coverage[@]}" \ + "${shared_services[@]}" "${worker_coverage[@]}" \ INTEGRATION_WORKERS="${INTEGRATION_WORKERS:-1}" \ LITELLM_MODE=PRODUCTION \ "${license_env[@]}" \ @@ -276,7 +276,7 @@ env -i PATH="$PATH" HOME="$HOME" PYTHONPATH="$PYTHONPATH" \ INTEGRATION_ROUTING="$INTEGRATION_ROUTING" \ MCP_TEST_PEER_PYTHON="${MCP_TEST_PEER_PYTHON:-}" \ .venv/bin/python tests/integration/run.py "$suite" --results "$results" \ - "${shard_arguments[@]}" + "${shard_arguments[@]}" "${pytest_coverage[@]}" if [ "${INTEGRATION_COVERAGE:-0}" = 1 ]; then for covered_pid in "$proxy_pid" "$peer_pid"; do diff --git a/tests/integration/run.py b/tests/integration/run.py index 7ab8d59c02c..e8b7381345a 100644 --- a/tests/integration/run.py +++ b/tests/integration/run.py @@ -101,6 +101,7 @@ def main() -> int: parser.add_argument("--shard-index", type=int, default=int(os.environ.get("INTEGRATION_CASE_SHARD_INDEX", "0"))) parser.add_argument("--shard-files", type=Path) parser.add_argument("--list", action="store_true", help="print selected candidate files and exit") + parser.add_argument("--coverage", action="store_true", help="collect coverage for this run") parser.add_argument("files", nargs="*", help="run only these files, or pytest node ids inside them, of the group") options: Final = parser.parse_intermixed_args() root: Final = Path(__file__).resolve().parents[2] @@ -141,6 +142,7 @@ def main() -> int: "-m", "pytest", *selection.nodes, + *(("--cov=litellm", f"--cov-report=xml:{output / 'coverage.xml'}") if options.coverage else ()), "-vv", "-rs", "--strict-markers",