Skip to content

test: expand test coverage from 7 to 65 cases - #1

Merged
proxyBug merged 1 commit into
mainfrom
claude/test-coverage-analysis-OGkUC
Jun 1, 2026
Merged

test: expand test coverage from 7 to 65 cases#1
proxyBug merged 1 commit into
mainfrom
claude/test-coverage-analysis-OGkUC

Conversation

@proxyBug

Copy link
Copy Markdown
Owner

$(cat <<'EOF'

Summary

  • Grows the test suite from 7 to 65 test cases across 14 test classes
  • Adds first-ever coverage for cli.py, render_json, render_table, format_report, and all collection-orchestration functions
  • All tests use mocks so they run offline with no real ss, netstat, docker, or /proc access

What's new

AreaClasses addedKey scenarios
_safe_intSafeIntTestsvalid int, non-numeric, empty, None
parse_process_fieldParseProcessFieldTestssingle process, systemd preference, all-systemd fallback
parse_netstat_lineParseNetstatLineTestsTCP LISTEN, UDP (UNCONN state), header skip, too-few-fields
lookup_userLookupUserTestsNone pid, missing /proc, PermissionError, uid→name resolution
infer_systemd_unitInferSystemdUnitTestsNone pid, missing cgroup file, service unit extraction
_dedupe_notesDedupNotesTestsdedup, blank filtering, order preservation
collect_listening_socketsCollectListeningSocketsTestsss success, netstat fallback, no tools, ss stderr note
collect_docker_containersCollectDockerContainersTestsnot installed, ps failure, successful JSON parse
collect_inventoryCollectInventoryTestsdocker skip, note merging, note dedup
render_jsonRenderJsonTestsvalid JSON, newline, endpoint fields
render_tableRenderTableTestssection headers, column headers, data, empty message, notes
format_reportFormatReportTestsjson/table/markdown dispatch, unknown-format fallback
build_parserBuildParserTestsdefaults, --no-docker, --no-systemd, --format, --output
mainMainTestsno subcommand→1, scan→0, flag forwarding, file output

Test plan

  • python -m unittest discover -s tests -v → 65 passed, 0 failed

https://claude.ai/code/session_01LFeBf9uLHNE2vu4fodoNnh
EOF
)


Generated by Claude Code

Add tests for all previously untested modules and functions:
- _safe_int, parse_process_field (including multi-process/systemd preference logic)
- parse_netstat_line (TCP, UDP, header-skip, too-few-fields)
- lookup_user and infer_systemd_unit with /proc edge cases (missing, permission denied)
- _dedupe_notes (dedup, blank filtering, order preservation)
- collect_listening_sockets (ss success, netstat fallback, no tools, stderr note)
- collect_docker_containers (not installed, ps failure, successful parse)
- collect_inventory (docker skip, note merging, dedup)
- render_json, render_table, format_report dispatcher
- build_parser flag coverage and main() integration (no-subcommand, file output, flag forwarding)
https://claude.ai/code/session_01LFeBf9uLHNE2vu4fodoNnh
@proxyBug
proxyBug marked this pull request as ready for review June 1, 2026 18:59
@proxyBug
proxyBug merged commit 6796b35 into mainJun 1, 2026
2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@proxyBug@claude