Skip to content

Add tests for Ruff dev deps not removed when using pre-commit#1464

Merged
nathanjmcdougall merged 3 commits intomainfrom
copilot/fix-dev-dep-removal-issue
Mar 22, 2026
Merged

Add tests for Ruff dev deps not removed when using pre-commit#1464
nathanjmcdougall merged 3 commits intomainfrom
copilot/fix-dev-dep-removal-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

The code fix to stop removing dev deps during pre-commit migration (commit 3a06c95) only added test coverage for codespell and pyproject-fmt. Ruff was explicitly called out as affected but had no test coverage.

Tests added

  • TestPreCommit.TestAdd.test_ruff_used — Ruff dev dep persists when use_pre_commit() is called after use_ruff()
  • TestPreCommit.TestMigration.test_ruff_deps_not_removed_when_migrating_to_pre_commit — Ruff dep survives migration to pre-commit
  • TestPreCommit.TestMigration.test_ruff_deps_not_added_when_migrating_from_pre_commit — Ruff dep not duplicated when removing pre-commit
  • TestRuff.TestPrecommitIntegration.test_use_first / test_use_after — Extended existing hook-only assertions to also verify dev dep presence in both orderings
Original prompt

This section details on the original issue you should resolve

<issue_title>Don't remove dev deps just because they're also configured as pre-commit hooks</issue_title>
<issue_description>For example, currently Ruff is being removed as a dev dep when running usethis tool pre-commit.

When using uv and hence sync-with-uv, there's absolutely no need.

If using a None backend, we don't touch dev deps anyway.

For a future backend, hopefully we'll have another sync tool.

Make sure to test this case.</issue_description>

Comments on the Issue (you are @copilot in this section)

@nathanjmcdougall Related to #1014

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 22, 2026 19:10
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/9b1d5f0b-61a3-46d4-bacf-a1ae0dfc4b50
Copilot AI changed the title [WIP] Fix dev dependencies removal in pre-commit configuration Add tests for Ruff dev deps not removed when using pre-commit Mar 22, 2026
Copilot AI requested a review from nathanjmcdougall March 22, 2026 19:14
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 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 22, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/fix-dev-dep-removal-issue (2cfa912) with main (43ce117)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 22, 2026 21:55
@nathanjmcdougall nathanjmcdougall merged commit ff97e29 into main Mar 22, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/fix-dev-dep-removal-issue branch March 22, 2026 21:55
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.

Don't remove dev deps just because they're also configured as pre-commit hooks

2 participants