|
8 | 8 | from bumpversion.exceptions import ConfigurationError
|
9 | 9 | from bumpversion.files import ConfiguredFile
|
10 | 10 | from bumpversion.scm import Git, SCMInfo
|
11 |
| -from tests.conftest import get_config_data |
| 11 | +from tests.conftest import get_config_data, inside_dir |
12 | 12 |
|
13 | 13 |
|
14 | 14 | @pytest.fixture
|
@@ -116,15 +116,30 @@ def test_do_bump_with_new_version(mock_update_config_file, mock_modify_files):
|
116 | 116 | assert mock_update_config_file.call_args[0][3] is True
|
117 | 117 |
|
118 | 118 |
|
| 119 | +@patch("bumpversion.files.modify_files") |
| 120 | +@patch("bumpversion.bump.update_config_file") |
| 121 | +def test_do_bump_when_new_equals_current(mock_update_config_file, mock_modify_files, tmp_path: Path): |
| 122 | + """When the new version is the same as the current version, nothing should happen.""" |
| 123 | + |
| 124 | + # Arrange |
| 125 | + version_part = None |
| 126 | + new_version = "1.2.3" |
| 127 | + |
| 128 | + with inside_dir(tmp_path): |
| 129 | + config, version_config, current_version = get_config_data({"current_version": "1.2.3"}) |
| 130 | + # Act |
| 131 | + bump.do_bump(version_part, new_version, config) |
| 132 | + |
| 133 | + # Assert |
| 134 | + mock_modify_files.assert_not_called() |
| 135 | + mock_update_config_file.assert_not_called() |
| 136 | + |
| 137 | + |
119 | 138 | def test_do_bump_with_no_arguments():
|
120 | 139 | # Arrange
|
121 | 140 | version_part = None
|
122 | 141 | new_version = None
|
123 |
| - config, version_config, current_version = get_config_data( |
124 |
| - { |
125 |
| - "current_version": "1.2.3", |
126 |
| - } |
127 |
| - ) |
| 142 | + config, version_config, current_version = get_config_data({"current_version": "1.2.3"}) |
128 | 143 | config.scm_info = SCMInfo()
|
129 | 144 | dry_run = False
|
130 | 145 |
|
|
0 commit comments