diff options
author | chrisjbillington <chrisjbillington@gmail.com> | 2020-05-11 14:45:43 -0400 |
---|---|---|
committer | chrisjbillington <chrisjbillington@gmail.com> | 2020-05-11 17:25:34 -0400 |
commit | e62d4aac4b2e9fa7c5c120f2f3b5108db21d52a2 (patch) | |
tree | b444580225dacd0a8789ffc8372d2362d8f5147e /testing | |
parent | 6ad91d0085acc8091f2336faaf4710c1bae4cf18 (diff) | |
download | setuptools-scm-e62d4aac4b2e9fa7c5c120f2f3b5108db21d52a2.tar.gz |
Add release-branch-semver scheme
This is a scheme that assumes that the upcoming release for most
branches is a minor release, and that only for release branches
(those whose branch names parse as a version number according to current
configuration) is the upcoming version a patch release.
Better document the differences between the schemes in README.rst
Diffstat (limited to 'testing')
-rw-r--r-- | testing/test_version.py | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/testing/test_version.py b/testing/test_version.py index 459d24b..3f2b10a 100644 --- a/testing/test_version.py +++ b/testing/test_version.py @@ -1,6 +1,11 @@ import pytest from setuptools_scm.config import Configuration -from setuptools_scm.version import meta, simplified_semver_version, tags_to_versions +from setuptools_scm.version import ( + meta, + simplified_semver_version, + release_branch_semver, + tags_to_versions, +) c = Configuration() @@ -44,6 +49,42 @@ def test_next_semver(version, expected_next): @pytest.mark.parametrize( + "version, expected_next", + [ + pytest.param(meta("1.0.0", config=c), "1.0.0", id="exact"), + pytest.param( + meta("1.0.0", distance=2, branch="master", config=c), + "1.1.0.dev2", + id="development_branch", + ), + pytest.param( + meta("1.0.0rc1", distance=2, branch="master", config=c), + "1.1.0.dev2", + id="development_branch_release_candidate", + ), + pytest.param( + meta("1.0.0", distance=2, branch="maintenance/1.0.x", config=c), + "1.0.1.dev2", + id="release_branch_legacy_version", + ), + pytest.param( + meta("1.0.0", distance=2, branch="release-1.0", config=c), + "1.0.1.dev2", + id="release_branch_with_prefix", + ), + pytest.param( + meta("1.0.0", distance=2, branch="bugfix/3434", config=c), + "1.1.0.dev2", + id="false_positive_release_branch", + ), + ], +) +def test_next_release_branch_semver(version, expected_next): + computed = release_branch_semver(version) + assert computed == expected_next + + +@pytest.mark.parametrize( "tag, expected", [ pytest.param("v1.0.0", "1.0.0"), |