From ff853ccc3854320cbc069b226a5fb7bbf1186c8f Mon Sep 17 00:00:00 2001
From: Courtney Pacheco <6019922+courtneypacheco@users.noreply.github.com>
Date: Mon, 10 Mar 2025 19:30:28 -0400
Subject: [PATCH] fix: Use `--with-editable` to capture accurate code coverage
reporting (#1532)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
# What does this PR do?
I created a PR earlier today, but I realized the code coverage reporting
isn't correct: #1512
Essentially, we need to use `--with-editable` to enable develop/editable
mode through `uv`. Using editable mode will create a package.egg-link
file, and that allows pytest to accurately capture code coverage.
Before, some files had "0%" or "100%" coverage, which isn't accurate:
More info on `--with-editable`:
https://docs.astral.sh/uv/reference/cli/#uv-run--with-editable
[//]: # (If resolving an issue, uncomment and update the line below)
[//]: # (Closes #[issue-number])
## Test Plan
Tested locally
Screenshot from CI:
[//]: # (## Documentation)
Signed-off-by: Courtney Pacheco <6019922+courtneypacheco@users.noreply.github.com>
---
.github/workflows/unit-tests.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index 075aa8527..48658047f 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -23,7 +23,7 @@ jobs:
- name: Run unit tests
run: |
- uv run -p 3.10.16 --with . --with ".[dev]" --with ".[unit]" pytest --cov=. -s -v tests/unit/ --junitxml=pytest-report.xml
+ uv run -p 3.10.16 --with-editable . --with-editable ".[dev]" --with-editable ".[unit]" pytest --cov=llama_stack -s -v tests/unit/ --junitxml=pytest-report.xml
- name: Upload test results
if: always()