Repository navigation
test(html): cover graph_to_html - #254
Merged
Merged
Conversation
Refs trailofbits#96 — a first step toward the requested coverage, not the whole of it. src/it_depends/html.py goes from 14% to 92% (36 statements, 3 still missed), and the suite from 110 to 123 passing tests. Overall coverage moves 57% -> 59%. The 13 cases cover the substitution of every template placeholder (a leftover $NODES/$EDGES/$TITLE/$LAYOUT would mean a branch never ran), the default and explicit titles, the cache-vs-graph input path, collapse_versions both ways, the root styling applied to a source package, and the edge-label branch that is skipped when a dependency name matches its package name. Not covered: the graph.source_packages path and the per-node level assignment (lines 106 and 132), which need a source-repository-backed graph, and the vulnerability tint at line 130. Overall coverage is 59%, so trailofbits#96's 90% target needs substantially more than this; the remaining gaps are concentrated in resolution.py (189 missed), docker.py (187), cmake.py (177) and go.py (158).
This was referenced Oct 2, 2026
evandowning
approved these changes
Oct 26, 2026
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.
Refs #96. This is a first step toward the coverage target, not the whole of it.
What this covers
src/it_depends/html.pygoes from 14% to 92% (36 statements, 3 still missed), and the suite from 110 to 123 passing tests. Overall coverage moves 57% -> 59%.The 13 cases in
test/test_html.pycover:$NODES/$EDGES/$TITLE/$LAYOUTwould mean one of the branches never ran;title=;PackageCacherather than aDependencyGraph, asserted to produce the same output as passingcache.to_graph()directly;collapse_versionsin both directions;shape/color/borderWidth) applied to a source package, and a plain dependency not getting it;collapse_versions=False;What it does not cover
Three lines remain in
html.py:106 and 132 need a source-repository-backed graph, and 130 needs a package carrying a vulnerability. I left them rather than build a fixture I could not verify quickly; they are a reasonable next step.
Verification
On the target
59% is not 90%, and I would rather say that plainly than let this read as closing #96. The remaining gaps are concentrated and large:
If you would rather take coverage one module per PR like this one, that is the shape I would keep following; if you want a specific module first, say which and I will do that instead.