setuptools_scm icon indicating copy to clipboard operation
setuptools_scm copied to clipboard

test_calver_by_date fails in 6.4.2

Open QuLogic opened this issue 2 years ago • 4 comments

It is currently Thu 17 Feb 2022 08:06:04 PM EST; which in UTC is Fri 18 Feb 2022 01:06:46 AM. Whether test_calver_by_date confuses time zones, or whether it adds some time span that flips into another day, I don't know, but they fail:

=================================== FAILURES ===================================
_____________________ test_calver_by_date[dirty other day] _____________________

version = <ScmVersion 22.2.14 d=0 n=None d=True b=None>
expected_next = '22.2.17.0.dev0'

    @pytest.mark.parametrize(
        "version, expected_next",
        [
            pytest.param(
                meta(date_to_str(days_offset=3), config=c),
                date_to_str(days_offset=3),
                id="exact",
            ),
            pytest.param(
                meta(date_to_str() + ".1", config=c), date_to_str() + ".1", id="exact patch"
            ),
            pytest.param(
                meta("20.01.02", config=c),
                "20.1.2",
                id="leading 0s",
            ),
            pytest.param(
                meta(date_to_str(days_offset=3), config=c, dirty=True),
                date_to_str() + ".0.dev0",
                id="dirty other day",
            ),
            pytest.param(
                meta(date_to_str(), config=c, distance=2, branch="default"),
                date_to_str() + ".1.dev2",
                id="normal branch",
            ),
            pytest.param(
                meta(date_to_str(fmt="{dt:%Y}.{dt.month}.{dt.day}"), config=c),
                date_to_str(fmt="{dt:%Y}.{dt.month}.{dt.day}"),
                id="4 digits year",
            ),
            pytest.param(
                meta(date_to_str(), config=c, distance=2, branch="release-2021.05.06"),
                "2021.05.06",
                id="release branch",
            ),
            pytest.param(
                meta(date_to_str() + ".2", config=c, distance=2, branch="release-21.5.1"),
                "21.5.1",
                id="release branch short",
            ),
            pytest.param(
                meta(
                    date_to_str(days_offset=3) + ".2",
                    config=c,
                    node_date=date.today() - timedelta(days=2),
                ),
                date_to_str(days_offset=3) + ".2",
                id="node date clean",
            ),
            pytest.param(
                meta(
                    date_to_str(days_offset=2) + ".2",
                    config=c,
                    distance=2,
                    node_date=date.today() - timedelta(days=2),
                ),
                date_to_str(date.today() - timedelta(days=2)) + ".3.dev2",
                id="node date distance",
            ),
            pytest.param(
                meta(
                    "1.2.0",
                    config=c,
                    distance=2,
                    node_date=date.today() - timedelta(days=2),
                ),
                date_to_str(days_offset=2) + ".0.dev2",
                marks=pytest.mark.filterwarnings(
                    "ignore:.*not correspond to a valid versioning date.*:UserWarning"
                ),
                id="using on old version tag",
            ),
        ],
    )
    def test_calver_by_date(version, expected_next):
        computed = calver_by_date(version)
>       assert computed == expected_next
E       AssertionError: assert '22.2.18.0.dev0' == '22.2.17.0.dev0'
E         - 22.2.17.0.dev0
E         ?       ^
E         + 22.2.18.0.dev0
E         ?       ^

testing/test_version.py:295: AssertionError
______________________ test_calver_by_date[normal branch] ______________________

version = <ScmVersion 22.2.17 d=2 n=None d=False b=default>
expected_next = '22.2.17.1.dev2'

    @pytest.mark.parametrize(
        "version, expected_next",
        [
            pytest.param(
                meta(date_to_str(days_offset=3), config=c),
                date_to_str(days_offset=3),
                id="exact",
            ),
            pytest.param(
                meta(date_to_str() + ".1", config=c), date_to_str() + ".1", id="exact patch"
            ),
            pytest.param(
                meta("20.01.02", config=c),
                "20.1.2",
                id="leading 0s",
            ),
            pytest.param(
                meta(date_to_str(days_offset=3), config=c, dirty=True),
                date_to_str() + ".0.dev0",
                id="dirty other day",
            ),
            pytest.param(
                meta(date_to_str(), config=c, distance=2, branch="default"),
                date_to_str() + ".1.dev2",
                id="normal branch",
            ),
            pytest.param(
                meta(date_to_str(fmt="{dt:%Y}.{dt.month}.{dt.day}"), config=c),
                date_to_str(fmt="{dt:%Y}.{dt.month}.{dt.day}"),
                id="4 digits year",
            ),
            pytest.param(
                meta(date_to_str(), config=c, distance=2, branch="release-2021.05.06"),
                "2021.05.06",
                id="release branch",
            ),
            pytest.param(
                meta(date_to_str() + ".2", config=c, distance=2, branch="release-21.5.1"),
                "21.5.1",
                id="release branch short",
            ),
            pytest.param(
                meta(
                    date_to_str(days_offset=3) + ".2",
                    config=c,
                    node_date=date.today() - timedelta(days=2),
                ),
                date_to_str(days_offset=3) + ".2",
                id="node date clean",
            ),
            pytest.param(
                meta(
                    date_to_str(days_offset=2) + ".2",
                    config=c,
                    distance=2,
                    node_date=date.today() - timedelta(days=2),
                ),
                date_to_str(date.today() - timedelta(days=2)) + ".3.dev2",
                id="node date distance",
            ),
            pytest.param(
                meta(
                    "1.2.0",
                    config=c,
                    distance=2,
                    node_date=date.today() - timedelta(days=2),
                ),
                date_to_str(days_offset=2) + ".0.dev2",
                marks=pytest.mark.filterwarnings(
                    "ignore:.*not correspond to a valid versioning date.*:UserWarning"
                ),
                id="using on old version tag",
            ),
        ],
    )
    def test_calver_by_date(version, expected_next):
        computed = calver_by_date(version)
>       assert computed == expected_next
E       AssertionError: assert '22.2.18.0.dev2' == '22.2.17.1.dev2'
E         - 22.2.17.1.dev2
E         ?       ^ ^
E         + 22.2.18.0.dev2
E         ?       ^ ^

testing/test_version.py:295: AssertionError

QuLogic avatar Feb 18 '22 01:02 QuLogic