File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 59
59
command: my-command
60
60
"""
61
61
62
+ MULTIPLE_VERSIONS_TO_UPDATE_POETRY_LOCK = """
63
+ [[package]]
64
+ name = "to-update-1"
65
+ version = "1.2.9"
66
+
67
+ [[package]]
68
+ name = "not-to-update"
69
+ version = "1.3.3"
70
+
71
+ [[package]]
72
+ name = "not-to-update"
73
+ version = "1.3.3"
74
+
75
+ [[package]]
76
+ name = "not-to-update"
77
+ version = "1.3.3"
78
+
79
+ [[package]]
80
+ name = "not-to-update"
81
+ version = "1.3.3"
82
+
83
+ [[package]]
84
+ name = "not-to-update"
85
+ version = "1.3.3"
86
+
87
+ [[package]]
88
+ name = "to-update-2"
89
+ version = "1.2.9"
90
+ """
91
+
62
92
MULTIPLE_VERSIONS_INCREASE_STRING = 'version = "1.2.9"\n ' * 30
63
93
MULTIPLE_VERSIONS_REDUCE_STRING = 'version = "1.2.10"\n ' * 30
64
94
@@ -119,6 +149,13 @@ def docker_compose_file(tmpdir):
119
149
return str (tmp_file )
120
150
121
151
152
+ @pytest .fixture (scope = "function" )
153
+ def multiple_versions_to_update_poetry_lock (tmpdir ):
154
+ tmp_file = tmpdir .join ("pyproject.toml" )
155
+ tmp_file .write (MULTIPLE_VERSIONS_TO_UPDATE_POETRY_LOCK )
156
+ return str (tmp_file )
157
+
158
+
122
159
@pytest .fixture (scope = "function" )
123
160
def version_files (
124
161
commitizen_config_file ,
@@ -228,3 +265,15 @@ def test_file_version_inconsistent_error(
228
265
"version_files are possibly inconsistent."
229
266
)
230
267
assert expected_msg in str (excinfo .value )
268
+
269
+
270
+ def test_multiplt_versions_to_bump (multiple_versions_to_update_poetry_lock ):
271
+ old_version = "1.2.9"
272
+ new_version = "1.2.10"
273
+ location = f"{ multiple_versions_to_update_poetry_lock } :version"
274
+
275
+ bump .update_version_in_files (old_version , new_version , [location ])
276
+ with open (multiple_versions_to_update_poetry_lock , "r" ) as f :
277
+ data = f .read ()
278
+ assert len (re .findall (old_version , data )) == 0
279
+ assert len (re .findall (new_version , data )) == 2
You can’t perform that action at this time.
0 commit comments