Skip to content

Commit 085f22c

Browse files
authored
Merge pull request #70168 from dwoz/dwoz/fix/test-current-release-argon-master
test_version: assert current_release() contract, not a hardcoded codename
2 parents 12141ba + f2c2ae4 commit 085f22c

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

tests/pytests/unit/test_version.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ def test_current_release_matches_maintenance_branch_67061():
446446
built distribution. Pin ``current_release()`` to the branch's own
447447
codename so the default version always matches the branch's calver
448448
series.
449+
450+
This asserts the *contract* -- current_release() returns the last
451+
codename with released=True -- rather than a hardcoded codename.
452+
That way the assertion tracks the released-flag state automatically
453+
on every branch and doesn't need editing when new codenames flip
454+
to released=True.
449455
"""
450456
# Reset any cached _current_release that an earlier import set so we
451457
# exercise the real lookup path.
@@ -455,18 +461,15 @@ def test_current_release_matches_maintenance_branch_67061():
455461
_next_release=None,
456462
_current_release=None,
457463
):
458-
# The fix picks the *last* released codename rather than the first
459-
# un-released one. 3008.x is still pre-release (ARGON.released is
460-
# False), so the last released codename on this branch is its
461-
# predecessor (CHLORINE). Once 3008.x cuts its first release and
462-
# ARGON flips to released=True, this assertion should be bumped.
464+
released = [v for v in SaltVersionsInfo.versions() if v.released]
465+
assert released, "SaltVersionsInfo table has no released codenames"
466+
expected = released[-1]
463467
current = SaltVersionsInfo.current_release()
464-
assert current == SaltVersionsInfo.CHLORINE, (
465-
f"On the 3008.x branch the most-recent released codename is "
466-
f"Chlorine (3007); current_release() returned "
467-
f"{current.name} ({current.info[0]})."
468+
assert current == expected, (
469+
f"current_release() must return the last codename with "
470+
f"released=True (expected {expected.name} / {expected.info[0]}), "
471+
f"got {current.name} / {current.info[0]}."
468472
)
469-
assert current.info[0] == 3007
470473

471474

472475
@pytest.mark.skip_unless_on_linux

0 commit comments

Comments
 (0)