-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The output of `git describe` uses `-` as a delimiter. Parsing tags caused splits in the parsing of version numbers. This joins all the remaining parts of the `git describe` with a `-`.
- Loading branch information
Showing
4 changed files
with
134 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""Tests for the config.__init__ module.""" | ||
|
||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
from bumpversion.scm import SCMInfo | ||
from bumpversion.config import check_current_version | ||
|
||
|
||
@dataclass | ||
class MockConfig: | ||
"""Just includes the current_version and scm_info attributes.""" | ||
|
||
current_version: Optional[str] | ||
scm_info: SCMInfo | ||
|
||
|
||
class TestCheckCurrentVersion: | ||
""" | ||
Tests for the check_current_version function. | ||
- tag may not match serialization | ||
- tag may not match current version in config | ||
""" | ||
|
||
def test_uses_tag_when_missing_current_version(self): | ||
"""When the config does not have a current_version, the last tag is used.""" | ||
# Assemble | ||
scm_info = SCMInfo() | ||
scm_info.current_version = "1.2.3" | ||
config = MockConfig(current_version=None, scm_info=scm_info) | ||
|
||
# Act | ||
result = check_current_version(config) | ||
|
||
# Assert | ||
assert result == "1.2.3" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters