Repository navigation
test(spec-tools): add unit tests for new fork codemods - #3776
Merged
spencer-tb merged 3 commits intoOct 13, 2026
Merged
spencer-tb merged 3 commits into
spencer-tb merged 3 commits into
Conversation
spencer-tb
approved these changes
Oct 13, 2026
Contributor
|
Thanks for the PR! Pushed a small trim of the tests and the tuple unpacking fix, LGTM :D |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/bogota #3776 +/- ##
=============================================
Coverage 94.98% 94.98%
=============================================
Files 673 673
Lines 40831 40831
Branches 3747 3747
=============================================
Hits 38785 38785
Misses 1429 1429
Partials 617 617
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
Adds
tests/spec_tools/test_codemods.pywith unit tests forCommentReplaceCommand,StringReplaceCommandandSetConstantCommand, using LibCST'sCodemodTestlike the issue suggests.RemoveDocstringCommandalready has tests intest_new_fork.py, so I left those where they are.SetConstantCommandneedsFullyQualifiedNameProvider, andCodemodTestdoesn't set up a cache for it, so those tests write the module to a temp directory and pass aFullRepoManagerthroughcontext_override.While writing these I noticed that
SetConstantCommandon a tuple assignment likeX, Y = 1, 2replaces the whole right hand side (X, Y = 3), whileX = Y = 1raisesNotImplementedError. No fork defines constants that way right now so I didn't touch it here, but I can send a fix separately.Related Issues or PRs
Fixes #2196
Checklist
just static<type>(<area>): <description>, where<type>and<area>come from an appropriateC-<type>, respectivelyA-<area>, label. The title should match the target squash commit message.Ran ruff, mypy and codespell on the new file. The full
just staticneeds the optimized group, which doesn't build on my Windows machine.Cute Animal Picture