Skip to content

Commit cb050a8

Browse files
committed
Add VersionNotFoundError test in test_bump.py
The code in test_bump.py file has been modified to include a test for VersionNotFoundError exception. This ensures that the implementation properly handles cases where a specified version could not be found.
1 parent 8f72f86 commit cb050a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_bump.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99

1010
from bumpversion import bump
11-
from bumpversion.exceptions import ConfigurationError
11+
from bumpversion.exceptions import ConfigurationError, VersionNotFoundError
1212
from bumpversion.files import ConfiguredFile
1313
from bumpversion.scm import Git, SCMInfo
1414
from tests.conftest import get_config_data, inside_dir
@@ -147,7 +147,8 @@ def test_doesnt_commit_if_modify_error(
147147
# Act
148148
with inside_dir(tmp_path):
149149
config = config.get_configuration(config_file=dest_config_path)
150-
bump.do_bump(version_part, None, config)
150+
with pytest.raises(VersionNotFoundError):
151+
bump.do_bump(version_part, None, config)
151152

152153
# Assert
153154
mock_commit_and_tag.assert_not_called()

0 commit comments

Comments
 (0)