|
9 | 9 |
|
10 | 10 | from bumpversion import exceptions, files
|
11 | 11 | from bumpversion.utils import get_context
|
| 12 | +from bumpversion.exceptions import VersionNotFoundError |
12 | 13 | from tests.conftest import get_config_data, inside_dir
|
13 | 14 |
|
14 | 15 |
|
@@ -153,15 +154,15 @@ def test_multi_file_configuration(tmp_path: Path):
|
153 | 154 | assert build_num_path.read_text() == "2.0.1+jane+38945"
|
154 | 155 |
|
155 | 156 |
|
156 |
| -def test_issue_14(tmp_path: Path): |
| 157 | +def test_raises_correct_missing_version_string(tmp_path: Path): |
157 | 158 | full_vers_path = tmp_path / "FULL_VERSION.txt"
|
158 | 159 | full_vers_path.write_text("3.1.0-rc+build.1031")
|
159 | 160 | assembly_path = tmp_path / "AssemblyInfo.cs"
|
160 | 161 | assembly_path.write_text(
|
161 | 162 | '[assembly: AssemblyFileVersion("3.1.0-rc+build.1031")]\n' '[assembly: AssemblyVersion("3.1.1031.0")]'
|
162 | 163 | )
|
163 | 164 | csv_path = tmp_path / "Version.csv"
|
164 |
| - csv_path.write_text("1;3;1;0;rc;build.1031") |
| 165 | + csv_path.write_text("1;3-1;0;rc;build.1031") |
165 | 166 |
|
166 | 167 | overrides = {
|
167 | 168 | "current_version": "3.1.0-rc+build.1031",
|
@@ -213,14 +214,11 @@ def test_issue_14(tmp_path: Path):
|
213 | 214 |
|
214 | 215 | ctx = get_context(conf)
|
215 | 216 |
|
216 |
| - for file_cfg in conf.files: |
217 |
| - cfg_file = files.ConfiguredFile(file_cfg, version_config) |
218 |
| - cfg_file.replace_version(current_version, major_version, ctx) |
| 217 | + configured_files = [files.ConfiguredFile(file_cfg, version_config) for file_cfg in conf.files] |
219 | 218 |
|
220 |
| - assert full_vers_path.read_text() == "3.1.1-beta+build.1031" |
221 |
| - expected = '[assembly: AssemblyFileVersion("3.1.1-beta+build.1031")]\n[assembly: AssemblyVersion("3.1.1031.1")]' |
222 |
| - assert assembly_path.read_text() == expected |
223 |
| - assert csv_path.read_text() == "1;3;1;1;beta;build.1031" |
| 219 | + with pytest.raises(VersionNotFoundError) as e: |
| 220 | + files.modify_files(configured_files, current_version, major_version, ctx) |
| 221 | + assert e.message.startswith("Did not find '1;3;1;0;rc;build.1031'") |
224 | 222 |
|
225 | 223 |
|
226 | 224 | def test_search_replace_to_avoid_updating_unconcerned_lines(tmp_path: Path):
|
|
0 commit comments