-
-
Notifications
You must be signed in to change notification settings - Fork 281
fix(wip): add test for current breaking change #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #372 +/- ##
=======================================
Coverage 97.59% 97.59%
=======================================
Files 39 39
Lines 1373 1373
=======================================
Hits 1340 1340
Misses 33 33
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Oh nice @Lee-W ! 💪🏻 |
right = right[line_break:] | ||
version_file = left + middle.replace(current_version, new_version) + right | ||
if regex: | ||
for match in re.finditer(regex, version_file, re.MULTILINE): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there, sorry to hear that my change broke the tool.
I think this approach could have a problem if the version would have a decimal change like from 9 to 10 as IIRC finditer still holds a reference to an old string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reproduce the error you could use this:
diff --git a/tests/test_bump_update_version_in_files.py b/tests/test_bump_update_version_in_files.py
index aebd879..3d289e2 100644
--- a/tests/test_bump_update_version_in_files.py
+++ b/tests/test_bump_update_version_in_files.py
@@ -39,15 +39,39 @@ REPEATED_VERSION_NUMBER = """
CARGO_LOCK = """
[[package]]
name = "textwrap"
-version = "1.2.3"
+version = "1.2.9"
[[package]]
name = "there-i-fixed-it"
-version = "1.2.3"
+version = "1.2.9"
[[package]]
name = "other-project"
-version = "1.2.3"
+version = "1.2.9"
+
+[[package]]
+name = "other-project"
+version = "1.2.9"
+
+[[package]]
+name = "other-project"
+version = "1.2.9"
+
+[[package]]
+name = "other-project"
+version = "1.2.9"
+
+[[package]]
+name = "other-project"
+version = "1.2.9"
+
+[[package]]
+name = "other-project"
+version = "1.2.9"
+
+[[package]]
+name = "other-project"
+version = "1.2.9"
"""
@@ -115,8 +139,8 @@ def test_partial_update_of_file(version_repeated_file):
def test_random_location(random_location_version_file):
- old_version = "1.2.3"
- new_version = "2.0.0"
+ old_version = "1.2.9"
+ new_version = "1.2.10"
location = f"{random_location_version_file}:there-i-fixed-it.+\nversion"
bump.update_version_in_files(old_version, new_version, [location])
@@ -127,8 +151,8 @@ def test_random_location(random_location_version_file):
def test_duplicates_are_change_with_no_regex(random_location_version_file):
- old_version = "1.2.3"
- new_version = "2.0.0"
+ old_version = "1.2.9"
+ new_version = "1.2.10"
location = f"{random_location_version_file}:version"
bump.update_version_in_files(old_version, new_version, [location])
i think that a way (hacky though) to fix this would keep and offset variable that gets the string difference from the old version to the new (it can be positive and negative) so you take accountable this kind of problem
Description
This is a WIP to fix the current BREAKING CHANGE which includes the test that should pass.
Because we don't want to bump, we should provide a fix of the breaking change.
In the meanwhile you can use commitizen<2.17.0
Checklist
./script/format
and./script/test
locally to ensure this change passes linter check and testExpected behavior
Steps to Test This Pull Request
Additional context