diff options
author | Iker Reyes <ikerreyes@users.noreply.github.com> | 2021-03-12 08:43:22 +0100 |
---|---|---|
committer | Iker Reyes <ikerreyes@users.noreply.github.com> | 2021-03-12 08:43:22 +0100 |
commit | 24014aaad0811f603ddd9132bac30d694ac9c4ad (patch) | |
tree | 631fb5ad0cde68c3d0c41859e77157ea2a3502c9 /testing/test_version.py | |
parent | b6f761254788fa510fc6127a66c861f913af1765 (diff) | |
download | setuptools-scm-24014aaad0811f603ddd9132bac30d694ac9c4ad.tar.gz |
Removed leading v/V match from calver and set future date warning
setuptools_scm already does the removal
Diffstat (limited to 'testing/test_version.py')
-rw-r--r-- | testing/test_version.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/test_version.py b/testing/test_version.py index a401412..7fb35ec 100644 --- a/testing/test_version.py +++ b/testing/test_version.py @@ -186,6 +186,12 @@ def date_to_str(date_=None, days_offset=0, fmt="{dt:%y}.{dt.month}.{dt.day}"): "version, expected_next", [ pytest.param(meta("1.0.0", config=c), "1.0.0", id="SemVer exact"), + pytest.param( + meta("1.0.0", config=c, dirty=True), + "1.0.0", + id="SemVer dirty", + marks=pytest.mark.xfail, + ), pytest.param(meta(date_to_str(), config=c), date_to_str(), id="exact"), pytest.param( meta(date_to_str() + ".1", config=c), date_to_str() + ".1", id="exact patch" @@ -245,8 +251,36 @@ def date_to_str(date_=None, days_offset=0, fmt="{dt:%y}.{dt.month}.{dt.day}"): date_to_str(fmt="{dt:%Y}.{dt.month}.{dt.day}") + ".1", id="exact patch with 4 digits year", ), + # pytest.param( + # meta("v" + date_to_str(), config=c), date_to_str(), id="exact leading v" + # ), + # pytest.param( + # meta("v" + date_to_str() + ".1", config=c), + # date_to_str() + ".1", + # id="exact patch leading v", + # ), + # pytest.param( + # meta("v" + date_to_str(), config=c, distance=2), + # date_to_str() + ".1.dev2", + # id="distance with leading v", + # ), + # pytest.param( + # meta("v" + date_to_str() + ".1", config=c, dirty=True), + # date_to_str() + ".2.dev0", + # id="dirty patch leading v", + # ), + # pytest.param( + # meta("v" + date_to_str(days_offset=3), config=c, dirty=True), + # date_to_str() + ".0.dev0", + # id="offset leading v", + # ), ], ) def test_calver_by_date(version, expected_next): computed = calver_by_date(version) assert computed == expected_next + + +def test_calver_by_date_future_warning(): + with pytest.warns(UserWarning, match="your previous tag is in the future*"): + calver_by_date(meta(date_to_str(days_offset=-2), config=c, distance=2)) |