test: smoke tests for validate_paths and print_report#21
Open
bipinhcs11 wants to merge 1 commit into
Open
Conversation
validate_paths (directory recursion, explicit file, missing file, empty list, mixed path types) and print_report (exit-code 0/1, summary line, empty input) are the two functions wired to the `skill-gen validate` subcommand. Both were exported from validate.py but had zero test coverage — the existing test_validate.py only covered the validate() and validate_file() functions. Adds 14 new tests in two classes: TestValidatePaths — 9 tests for path/directory dispatch logic TestPrintReport — 5 tests for the CLI formatter return value Key regression pinned: validate_paths on the three reference skill directories must return 3 clean results; if a future edit breaks any reference skill the test fails. (skills/skill-generator/SKILL.md is a Claude Agent skill spec, not artifact-3, so targeted the three reference dirs explicitly rather than the whole skills/ tree.) Full suite: 172 → 186 tests, all green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
What and why
validate_pathsandprint_reportare the two functions wired to theskill-gen validatesubcommand — the entry point developers use to audit SKILL.md files before committing. Both were exported fromvalidate.pybut had zero test coverage. The existingtest_validate.pycoveredvalidate()andvalidate_file()only; the CLI-facing layer was untested.What's covered (14 new tests)
TestValidatePaths(9 tests)test_explicit_valid_file_returns_single_ok_resulttest_explicit_invalid_file_returns_single_error_resulttest_nonexistent_file_returns_error_resulttest_empty_path_list_returns_empty_listtest_directory_finds_all_skill_mds_recursivelytest_directory_with_no_skill_mds_returns_emptytest_mix_of_file_and_directory_combinedtest_results_have_path_attributepathfieldtest_three_reference_skill_dirs_all_okvalidate_pathscleanly; a future edit that breaks them will fail this testTestPrintReport(5 tests)test_all_ok_returns_zerotest_any_error_returns_onetest_output_contains_summary_linetest_empty_results_returns_zerotest_error_count_in_summaryNote on
skills/skill-generator/SKILL.mdThe
skills/tree contains a fourthSKILL.md— the Claude Agent skill spec atskills/skill-generator/SKILL.md. This file uses a different frontmatter schema (name:/description:rather than the artifact-3 fields) so it legitimately failsvalidate. The regression test therefore targets the three artifact-3 reference skill directories explicitly rather than the wholeskills/tree.Suite size
172 → 186 tests, all green.
Follow-ups (not in this PR)
cli.pyhas no tests.build_parser()is a pure function; smoke tests for all 11 subcommand argument shapes would catch future wiring bugs.tests/test_update.py; one of them should be merged and the rest closed.Generated by Claude Code