Skip to content

test: add unit tests for 8 previously untested Python modules - #4

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781783023-add-unit-tests
Open

test: add unit tests for 8 previously untested Python modules#4
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781783023-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Adds 91 unit tests across 8 new test files for every Python module in templates/spec-repo/bin/lib/ that previously had zero test coverage.

Coverage before: 3 modules tested (existing_issue.py, migrate_repos_registry.py, read_spec_repo.sh)
Coverage after: All 11 testable modules now have tests.

New test files

Test file Module under test Tests What's covered
test_validate_tickets.py validate_tickets.py 15 load_registry, _parse_repos_minimal, norm, capability_mismatch
test_issue_contract.py issue_contract.py 18 extract_section, is_placeholder, implementation_plan_text, has_substantive_impl_planning
test_extract_issue_sections.py extract_issue_sections.py 13 section, extract_json_block, is_placeholder, main() output
test_validate_issue_body.py validate_issue_body.py 20 validate() at fanout/expand/orchestrate levels, meta extraction, stage validation
test_toposort_tickets.py toposort_tickets.py 7 Linear/diamond deps, cycle detection, unknown refs, empty input
test_extract_task_meta.py extract_task_meta.py 10 JSON/YAML fence extraction, parse_task_meta edge cases
test_validate_prd_frontmatter.py validate_prd_frontmatter.py 8 extract_frontmatter, CLI integration (valid/missing fields/empty tickets/missing file)
test_prd_io.py prd_io.py 11 extract_frontmatter, load_prd, CLI commands (tickets_json, tickets_count, slices_json, get)
test_task_meta_to_yaml.py task_meta_to_yaml.py 7 Field filtering, depends_on default, non-dict rejection, stages

All tests use unittest (matching existing conventions) and run without external dependencies beyond PyYAML.

Link to Devin session: https://app.devin.ai/sessions/d6ac87688fa8429f83c530ec59d396c3
Requested by: @roborew

Add comprehensive unit tests for all Python library modules in
templates/spec-repo/bin/lib/ that had zero test coverage:

- test_validate_tickets.py: registry loading, capability mismatch, norm
- test_issue_contract.py: section extraction, placeholder detection, impl plan analysis
- test_extract_issue_sections.py: section/JSON block extraction, main output
- test_validate_issue_body.py: body validation at fanout/expand/orchestrate levels
- test_toposort_tickets.py: topological sort with deps, cycles, unknown refs
- test_extract_task_meta.py: task block extraction for YAML and JSON fences
- test_validate_prd_frontmatter.py: frontmatter validation integration tests
- test_prd_io.py: PRD loading, CLI commands (tickets_json, slices_json, get)
- test_task_meta_to_yaml.py: meta-to-YAML conversion, field filtering

Total: 91 new test cases across 8 files. All pass alongside existing tests.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant