fix(ci): isolate integration coverage from nested test runs

This commit is contained in:
moe-berri 2026-11-08 16:39:04 +08:00
parent 3d7dff533e
commit 9fd7f75358
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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",