Skip to content

Move test suite structure expectations into a prek hook#1583

Merged
nathanjmcdougall merged 4 commits intomainfrom
copilot/move-test-suite-expectations-prek-hook
Mar 27, 2026
Merged

Move test suite structure expectations into a prek hook#1583
nathanjmcdougall merged 4 commits intomainfrom
copilot/move-test-suite-expectations-prek-hook

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

The test skeleton check (every tests/usethis/**/test_*.py must have a matching source module) was enforced as a pytest test. This belongs in the prek hook pipeline where other structural/convention checks live.

  • New hook hooks/check-test-skeleton.py: Pure-Python bespoke hook that validates test-to-source module correspondence across four naming patterns (direct, underscore-prefixed, parent-stripped, underscore-parent-stripped). Reports all mismatches at once rather than failing on the first.
  • Wired into .pre-commit-config.yaml: Local system hook, priority: 0, placed alongside the other bespoke check hooks.
  • Removed test_skeleton_matches from tests/test_suite.py: The fixture-related test_uv_init_not_git_repo test remains.

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI and others added 2 commits March 27, 2026 04:58
Create hooks/check-test-skeleton.py that validates every test file has a
matching source module. Wire it into .pre-commit-config.yaml as a local
hook with priority 0. Remove the test from tests/test_suite.py.

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/d402dbfe-b934-480c-a0b8-56bee1f9cdb4

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Move test suite structure expectations into a prek hook Move test suite structure expectations into a prek hook Mar 27, 2026
Copilot AI requested a review from nathanjmcdougall March 27, 2026 05:02
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 27, 2026 08:55
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 27, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/move-test-suite-expectations-prek-hook (a5eb4e3) with main (905dd17)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall merged commit cf43cc2 into main Mar 27, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/move-test-suite-expectations-prek-hook branch March 27, 2026 09:15
@nathanjmcdougall nathanjmcdougall linked an issue Mar 29, 2026 that may be closed by this pull request
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.

Move test suite structure expectations into a prek hook

2 participants