diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-06-15 16:30:02 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-06-16 06:57:01 +0200 |
commit | 256405dcfd7bc3702a72b1700ce571704596bf23 (patch) | |
tree | 3e895593b570a6490d656fa48e9eede7a3f2ff38 /script | |
parent | ef809ddc256a944f34289ef27be47655fdfa98a5 (diff) | |
download | astroid-git-256405dcfd7bc3702a72b1700ce571704596bf23.tar.gz |
Add test for getting the new version
Diffstat (limited to 'script')
-rw-r--r-- | script/bump_changelog.py | 7 | ||||
-rw-r--r-- | script/test_bump_changelog.py | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/script/bump_changelog.py b/script/bump_changelog.py index 21deb498..dae41e3e 100644 --- a/script/bump_changelog.py +++ b/script/bump_changelog.py @@ -32,7 +32,12 @@ def main() -> None: def get_next_version(version: str) -> str: new_version = version.split(".") - new_version[2] = str(int(new_version[2]) + 1) + patch = new_version[2] + reminder = None + if "-" in patch: + patch, reminder = patch.split("-") + patch = str(int(patch) + 1) + new_version[2] = patch if reminder is None else f"{patch}-{reminder}" return ".".join(new_version) diff --git a/script/test_bump_changelog.py b/script/test_bump_changelog.py new file mode 100644 index 00000000..4e70ab16 --- /dev/null +++ b/script/test_bump_changelog.py @@ -0,0 +1,9 @@ +import pytest +from bump_changelog import get_next_version + + +@pytest.mark.parametrize( + "version,expected", [["2.6.1", "2.6.2"], ["2.6.1-dev0", "2.6.2-dev0"]] +) +def test_get_next_version(version, expected): + assert get_next_version(version) == expected |