mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(ci): let the mutation workflow find covered lines so it generates mutants
mutmut's gather_coverage() looks each source file's covered lines up by absolute path, but [tool.coverage.run] sets relative_files = true, so every lookup misses. With mutate_only_covered_lines = true that leaves no line eligible for mutation, and the run ends on "Stopping early, because we could not find any test case for any mutant" after spending 26 minutes collecting coverage. The last four dispatches all died that way. Point COVERAGE_RCFILE at a small rc file for mutation runs only, so the coverage instance mutmut builds stores absolute paths. Scoped to one module locally this takes the run from 0 mutants to 8 generated and 8 killed. Also give the mutmut step a deadline inside the job's own. mutmut records each mutant's verdict to mutants/mutmut-stats.json as it finishes, so a run that outlasts its budget still scores what it got through, but a cancelled job skips the report and upload steps and publishes nothing. That is how the two runs before these four ended. Ignore mutants/ and .venv-mutmut, which a local run leaves behind untracked.
This commit is contained in:
parent
e300822483
commit
ae63786cfb
3 changed files with 16 additions and 0 deletions
5
.github/mutmut-coverage.rc
vendored
Normal file
5
.github/mutmut-coverage.rc
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# mutmut's gather_coverage() looks covered lines up by absolute path, so the
|
||||
# repo's `relative_files = true` makes every lookup miss and mutmut generates
|
||||
# zero mutants. Point COVERAGE_RCFILE here for mutation runs only.
|
||||
[run]
|
||||
relative_files = false
|
||||
9
.github/workflows/mutation-test.yml
vendored
9
.github/workflows/mutation-test.yml
vendored
|
|
@ -87,11 +87,20 @@ jobs:
|
|||
run: |
|
||||
uv pip uninstall pytest-retry || true
|
||||
|
||||
# Ends before the job's own deadline so a run that outlasts the budget is
|
||||
# still followed by the report and upload steps. mutmut writes each
|
||||
# mutant's result to mutants/mutmut-stats.json as it goes, so an
|
||||
# interrupted run still scores the mutants it finished; a cancelled job
|
||||
# skips those steps and publishes nothing at all.
|
||||
- name: Run mutmut
|
||||
timeout-minutes: 300
|
||||
env:
|
||||
# Make the mutants/ sandbox win over site-packages on sys.path so the
|
||||
# trampolined files are imported instead of the installed copy.
|
||||
PYTHONPATH: ${{ github.workspace }}/mutants
|
||||
# Without this mutmut finds no covered lines and generates 0 mutants.
|
||||
# See the file itself for why.
|
||||
COVERAGE_RCFILE: ${{ github.workspace }}/.github/mutmut-coverage.rc
|
||||
run: |
|
||||
set -o pipefail
|
||||
mkdir -p mutants
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -3,6 +3,8 @@
|
|||
tests/e2e/.fixtures/
|
||||
.venv-typecheck
|
||||
.venv_policy_test
|
||||
.venv-mutmut
|
||||
mutants/
|
||||
.env
|
||||
.claude
|
||||
CLAUDE.local.md
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue