Skip to content

Add test that pre-commit hooks actually runs successfully when adding…#800

Merged
nathanjmcdougall merged 5 commits intomainfrom
208-test-for-all-tools-that-the-pre-commit-actually-runs-on-an-empty-repo
Jun 25, 2025
Merged

Add test that pre-commit hooks actually runs successfully when adding…#800
nathanjmcdougall merged 5 commits intomainfrom
208-test-for-all-tools-that-the-pre-commit-actually-runs-on-an-empty-repo

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

… all tools at once

(at least, among the ones that have pre-commits)

… all tools at once

(at least, among the ones that have pre-commits)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SupportedToolType alias and refine ALL_TOOLS’ typing in all_.py
  • Add a new use_tool function in core/tool.py to replace individual use_… calls
  • Add an integration test in test_core_tool.py to 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_tool explaining 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_subprocess but 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_tool function references classes like CodespellTool and CoveragePyTool but 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
Copy link
Copy Markdown

codecov bot commented Jun 25, 2025

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 Jun 25, 2025

CodSpeed WallTime Performance Report

Merging #800 will not alter performance

Comparing 208-test-for-all-tools-that-the-pre-commit-actually-runs-on-an-empty-repo (e47556d) with main (f6e33be)

Summary

✅ 2 untouched benchmarks

@nathanjmcdougall nathanjmcdougall merged commit 3f8e1f8 into main Jun 25, 2025
19 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 208-test-for-all-tools-that-the-pre-commit-actually-runs-on-an-empty-repo branch June 25, 2025 02:04
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.

Test for all tools that the pre-commit actually runs on an empty repo

2 participants