From 24a4a1e167dbe2a70c64b94c5b9ddb7a878bcc5c Mon Sep 17 00:00:00 2001 From: ChristianZaccaria Date: Mon, 7 Jul 2025 11:41:18 +0100 Subject: [PATCH] Add coverage dependency to 'unit' group in pyproject.toml file --- .github/workflows/unit-tests.yml | 4 ++-- pyproject.toml | 1 + scripts/unit-tests.sh | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1435837e8..85ebb5731 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -51,7 +51,7 @@ jobs: - name: Check coverage run: | - coverage=$(uv run --python $PYTHON_VERSION coverage report -m | tail -1 | tail -c 4 | head -c 2) + coverage=$(uv run --python ${{ matrix.python }} --group unit coverage report -m | tail -1 | tail -c 4 | head -c 2) echo "Total coverage: ${coverage}%" # Check if coverage is below the threshold @@ -59,5 +59,5 @@ jobs: echo "Coverage failed at ${coverage}%, expected at least 40%" exit 1 else - echo "Coverage passed, ${coverage}%" + echo "Coverage check passed with ${coverage}%" fi diff --git a/pyproject.toml b/pyproject.toml index b557dfb9d..fc45f5405 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,6 +90,7 @@ unit = [ "pymilvus>=2.5.12", "litellm", "together", + "coverage", ] # These are the core dependencies required for running integration tests. They are shared across all # providers. If a provider requires additional dependencies, please add them to your environment diff --git a/scripts/unit-tests.sh b/scripts/unit-tests.sh index b8950c221..5f3071172 100755 --- a/scripts/unit-tests.sh +++ b/scripts/unit-tests.sh @@ -16,9 +16,6 @@ if [ $FOUND_PYTHON -ne 0 ]; then uv python install "$PYTHON_VERSION" fi -# Install coverage if not installed -uv pip install coverage >/dev/null 2>&1 - uv run --python "$PYTHON_VERSION" --with-editable . --group unit \ coverage run --source=llama_stack -m pytest -s -v tests/unit/ "$@" && \ uv run --python "$PYTHON_VERSION" coverage html -d htmlcov-$PYTHON_VERSION