Add test that pre-commit hooks actually runs successfully when adding…#800
Merged
nathanjmcdougall merged 5 commits intomainfrom Jun 25, 2025
Conversation
… all tools at once (at least, among the ones that have pre-commits)
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a unified use_tool dispatcher, updates tool type annotations, and verifies that pre-commit hooks run when all tools are added together.
- Introduce
SupportedToolTypealias and refineALL_TOOLS’ typing inall_.py - Add a new
use_toolfunction incore/tool.pyto replace individualuse_…calls - Add an integration test in
test_core_tool.pyto confirm pre-commit hooks execute for every tool
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/usethis/_core/test_core_tool.py | Imported use_tool and added TestMultipleIntegrations to run hooks |
| src/usethis/tool/all.py | Removed TYPE_CHECKING, added SupportedToolType alias, updated ALL_TOOLS typing |
| src/usethis/_core/tool.py | Imported assert_never, implemented use_tool with isinstance dispatch |
Comments suppressed due to low confidence (3)
src/usethis/_core/tool.py:47
- [nitpick] Consider adding a docstring to
use_toolexplaining its purpose and parameters (tool,remove,how) to improve maintainability and clarity.
def use_tool(
tests/usethis/_core/test_core_tool.py:1883
- The test invokes
call_uv_subprocessbut does not assert on its result or output. Adding an assertion (e.g., checking exit code or expected output) will make the test’s intention more explicit.
call_uv_subprocess(
src/usethis/_core/tool.py:47
- The new
use_toolfunction references classes likeCodespellToolandCoveragePyToolbut those classes are not imported in this module. Add the necessary imports (e.g.,from usethis._tool.impl.codespell import CodespellTool) to avoid NameError at runtime.
def use_tool(
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. 📢 Thoughts on this report? Let us know! |
CodSpeed WallTime Performance ReportMerging #800 will not alter performanceComparing Summary
|
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.
… all tools at once
(at least, among the ones that have pre-commits)