Repository navigation
Fix the coverage report path for a module outside the root - #14
Open
poliakarmai wants to merge 1 commit into
Open
poliakarmai wants to merge 1 commit into
poliakarmai wants to merge 1 commit into
Conversation
A run such as `crapper /path/to/repo` from another directory still analyses and prints the complexity table, then dies in coverage mode with a raw ValueError from `module.relative_to(root)`. The README documents passing a tree by path, so the traceback is not an acceptable answer. The fallback is the one analyze.py already uses for the same case: keep the absolute path when the module is not under the root. The slug is only a directory name for the lcov file, so any stable unique name works. Proved by running `crapper /tmp/ubtest` from an unrelated directory before (ValueError) and after (f, CC 1, 100%, CRAP 1.0, exit 0), plus test_coverage_report_accepts_a_module_outside_the_root. Suite: 144 passed, the 3 remaining failures need babashka and uml-viewer.
poliakarmai
force-pushed
the
fix/coverage-report-outside-root
branch
from
October 28, 2026 12:32
c9cecb6 to
d57ed65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
crapper /path/to/reporun from another directory works with--no-coverage, and dies in coverage mode:The README documents passing a tree by path, so a traceback is not the answer here.
The slug is only the directory name of that module's lcov file, so an absolute path
serves as well.
analyze.pyalready falls back to the absolute path for the samesituation; this uses the same fallback.
Proof. Before the change,
crapper /tmp/ubtestfrom an unrelated directory raisedthe
ValueErrorabove. After it:exit 0. Added
test_coverage_report_accepts_a_module_outside_the_rootnext to theexisting nested-module case.
pytest -q: 144 passed; the 3 failures need babashkaand uml-viewer and fail the same way without this change.