Move test suite structure expectations into a prek hook#1583
Merged
nathanjmcdougall merged 4 commits intomainfrom Mar 27, 2026
Merged
Move test suite structure expectations into a prek hook#1583nathanjmcdougall merged 4 commits intomainfrom
nathanjmcdougall merged 4 commits intomainfrom
Conversation
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>
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
nathanjmcdougall
approved these changes
Mar 27, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
The test skeleton check (every
tests/usethis/**/test_*.pymust have a matching source module) was enforced as a pytest test. This belongs in the prek hook pipeline where other structural/convention checks live.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..pre-commit-config.yaml: Local system hook,priority: 0, placed alongside the other bespoke check hooks.test_skeleton_matchesfromtests/test_suite.py: The fixture-relatedtest_uv_init_not_git_repotest remains.⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.