fix(test): CLI init test patching not triggered#1846
Merged
Conversation
The patching doesn't work because cargo still tries to fetch from git first before doing the patch, so instead we use a find replace approach. I have tested this with v1.4.0-rc.0 to ensure it works.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the CLI init test by replacing the previous patch-appending strategy with an in-place find-and-replace of the OpenVM dependency in Cargo.toml, ensuring local paths are used without Cargo fetching from Git.
- Switched from appending a
[patch]block to replacing the dependency line directly - Updated imports and added
itertools::Itertoolsfor joining lines - Renamed and re-implemented
append_patch_to_cargo_tomlasreplace_with_local_openvm
| let new_content = lines | ||
| .iter() | ||
| .map(|line| { | ||
| if line.starts_with("openvm = { git = \"https://github.com/openvm-org/openvm.git\"") { |
There was a problem hiding this comment.
The check with starts_with won’t match if the openvm line is indented. Consider using line.trim_start().starts_with(...) to handle leading whitespace.
Suggested change
| if line.starts_with("openvm = { git = \"https://github.com/openvm-org/openvm.git\"") { | |
| if line.trim_start().starts_with("openvm = { git = \"https://github.com/openvm-org/openvm.git\"") { |
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 patching doesn't work because cargo still tries to fetch from git first before doing the patch, so instead we use a find replace approach. I have tested this with v1.4.0-rc.0 to ensure it works.