Skip to content

test: smoke tests for update.py (was the only uncovered module)#17

Open
bipinhcs11 wants to merge 1 commit into
mainfrom
test/update-module-coverage
Open

test: smoke tests for update.py (was the only uncovered module)#17
bipinhcs11 wants to merge 1 commit into
mainfrom
test/update-module-coverage

Conversation

@bipinhcs11
Copy link
Copy Markdown
Owner

What and why

update.py (the Phase-2 incremental updater) was the only module in tools/skill_generator/ with no test file. Every other module — crawler, generate, validate, doctor, plan, link — had smoke tests added in earlier PRs. This PR closes that gap.

What's covered (30 new tests)

Class Function tested Cases
TestBumpVersion _bump_version normal increment, v1→v2, missing version line, large number, not confused by java_version:
TestResolveSkillsDir _resolve_skills_dir .github/skills/ found, skills/ found, neither returns None, .github/skills/ preferred when both exist
TestDomainFromSkill _domain_from_skill id/name set, .java classes extracted, .xml/.sql/.sh refs extracted, empty text no crash, description is ""
TestMapFilesToFeatures _map_files_to_features known file maps to feature, unknown file not mapped, missing skills dir returns {}, file claimed by two features, empty changed-files list
TestIngestResponsesHappyPath ingest_responses file written, version bumped, last_updated set to today, failed list empty
TestIngestResponsesNoSkillsDir ingest_responses returns error dict when no skills dir exists
TestIngestResponsesMissingResponseFile ingest_responses missing response → failed entry, not a crash
TestIngestResponsesEmptyResponse ingest_responses whitespace-only response → failed, not written
TestIngestResponsesMarkdownFenceStripped ingest_responses fenced response written without the fence
TestIngestResponsesFeatureFilter ingest_responses --feature flag restricts to one feature, leaves others untouched

The two subprocess-backed functions (_git_changed_files and emit_prompts) are not covered here — they require a live git repo and are exercised in manual QA. That is noted as a follow-up.

Test count

172 existing → 202 total. All pass (python3 -m unittest discover -s tests).

Follow-ups (not in this PR)

  • Integration test for emit_prompts against a real temp git repo with staged changes
  • Test for ingest_responses --commit path (requires mocking subprocess.run)

Generated by Claude Code

update.py (the Phase-2 incremental updater) was the only module in
tools/skill_generator/ with no test file. Adds test_update.py covering
all seven pure/side-effectful helpers:

  _bump_version         — version parse and increment (5 cases)
  _resolve_skills_dir   — .github/skills vs skills vs neither vs both (4)
  _domain_from_skill    — class/xml/sql/sh extraction from SKILL.md (7)
  _map_files_to_features — file→feature mapping, unknown, shared (5)
  ingest_responses      — version bump, last_updated, fence strip,
                          --feature filter, missing/empty response (8)

The two subprocess-backed functions (_git_changed_files, emit_prompts)
are not covered here — they require a real git repo and are exercised
in manual QA.

Test count: 172 existing → 202 total (30 new). All pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to 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