From 39ce3e692034fff2fd6a3b30ca180eaa5079001a Mon Sep 17 00:00:00 2001 From: John Bang Date: Wed, 23 Sep 2026 16:07:01 -0700 Subject: [PATCH] ci(coverage): isolate DeepSeek unit invocation --- .github/scripts/assert_ci_coverage.py | 2 +- .github/workflows/_test-unit-base.yml | 43 +++++++++++++++++++++++++++ .github/workflows/test-unit.yml | 7 ++--- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/.github/scripts/assert_ci_coverage.py b/.github/scripts/assert_ci_coverage.py index f62451eec14..fafbc4acd23 100644 --- a/.github/scripts/assert_ci_coverage.py +++ b/.github/scripts/assert_ci_coverage.py @@ -21,7 +21,7 @@ TESTS_ROOT = REPO_ROOT / "tests" ALLOWLIST_KEYS = frozenset({"description", "test_paths", "dockerfiles"}) PATH_FILTER_KEYS = frozenset({"paths", "paths-ignore"}) -TEST_PATH_KEYS = frozenset({"test-path", "test-paths"}) +TEST_PATH_KEYS = frozenset({"additional-test-path", "test-path", "test-paths"}) DOCKERFILE_INPUT_KEYS = frozenset({"file", "dockerfile"}) TEST_RUNNER_RE = re.compile(r"\bpytest\b|\bcircleci tests\b|\bhelm unittest\b|\bplaywright test\b|\bpython[0-9.]*\s") IMAGE_BUILD_RE = re.compile(r"\bdocker\s+(?:buildx\s+)?build\b") diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.yml index f4d4fb54ba6..2ff73b323ee 100644 --- a/.github/workflows/_test-unit-base.yml +++ b/.github/workflows/_test-unit-base.yml @@ -7,6 +7,11 @@ on: description: "Pytest path(s) to run" required: true type: string + additional-test-path: + description: "Pytest path(s) to run separately while appending coverage" + required: false + type: string + default: "" workers: description: "Number of pytest-xdist workers" required: false @@ -201,6 +206,44 @@ jobs: fi exit "$status" + - name: Run additional tests + if: steps.changes.outputs.decision != 'skip' && inputs.additional-test-path != '' + timeout-minutes: ${{ inputs.timeout-minutes }} + env: + TEST_PATH: ${{ inputs.additional-test-path }} + MAX_FAILURES: ${{ inputs.max-failures }} + WORKERS: ${{ inputs.workers }} + RERUNS: ${{ inputs.reruns }} + TEST_TIMEOUT_SECONDS: ${{ inputs.test-timeout-seconds }} + DIST: ${{ inputs.dist }} + COVERAGE_CORE: sysmon + run: | + xdist_args=() + if [ "${WORKERS}" != "0" ]; then + xdist_args=(-n "${WORKERS}" --dist="${DIST}") + fi + set +e + uv run --no-sync pytest ${TEST_PATH:?} \ + --tb=short -vv \ + --maxfail="${MAX_FAILURES}" \ + "${xdist_args[@]}" \ + --reruns "${RERUNS}" \ + --reruns-delay 1 \ + --timeout="${TEST_TIMEOUT_SECONDS}" \ + --rerun-except "from pytest-timeout" \ + --durations=20 \ + --cov=./litellm --cov=./enterprise/litellm_enterprise \ + --cov-append \ + --cov-report=xml:coverage.xml \ + --cov-config=pyproject.toml + status=$? + set -e + if [ "$status" -eq 5 ]; then + echo "pytest collected no tests from ${TEST_PATH}; passing" + exit 0 + fi + exit "$status" + - name: Save coverage report if: always() && steps.changes.outputs.decision != 'skip' uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index faacfbb516d..dc623737b22 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -95,10 +95,8 @@ jobs: - shard: All Other Providers artifact-name: llm-other-providers - test-path: >- - tests/test_litellm/llms - tests/unit/llms/deepseek/chat/test_deepseek_chat_transformation.py - --ignore=tests/test_litellm/llms/vertex_ai + test-path: "tests/test_litellm/llms --ignore=tests/test_litellm/llms/vertex_ai" + additional-test-path: "tests/unit/llms/deepseek/chat/test_deepseek_chat_transformation.py" workers: 2 reruns: 2 timeout-minutes: 20 @@ -259,6 +257,7 @@ jobs: uses: ./.github/workflows/_test-unit-base.yml with: test-path: ${{ matrix.test-path }} + additional-test-path: ${{ matrix.additional-test-path || '' }} workers: ${{ matrix.workers }} reruns: ${{ matrix.reruns }} timeout-minutes: ${{ matrix.timeout-minutes }}