fix: ensure exact tags resolve correctly in version fetching logic

This commit is contained in:
Rightup committed 2026-09-08 22:26:15 +01:00
1 parent d0a34d16e2
commit fd2571b6e7
2 files changed
+9

No files matched your search

+4
View File
@@ -693,6 +693,10 @@ def _fetch_latest_version(channel: str) -> str:
raise RuntimeError(
f"Could not compare {base_tag}...{channel} on GitHub: {exc}"
) from exc
# On an exact tag (ahead_by == 0), setuptools-scm reports the tag
# itself, not next-patch.dev0.
if ahead_by <= 0:
return base_tag
return _next_dev_version(base_tag, ahead_by)
# Static version channel — read the pinned version from pyproject.toml on
+5
View File
@@ -337,6 +337,11 @@ def test_fetch_latest_version_dynamic_and_static(monkeypatch):
dyn = ue._fetch_latest_version("dev")
assert dyn == "1.0.6.dev3"
# Exact tag (ahead_by == 0) must resolve to the tag, not next.dev0.
monkeypatch.setattr(ue, "_fetch_url", lambda _url, timeout=10: '{"ahead_by": 0}')
on_tag = ue._fetch_latest_version("main")
assert on_tag == "1.0.5"
# Static branch path parses version from pyproject content.
monkeypatch.setattr(ue, "_branch_is_dynamic", lambda _ch: False)
monkeypatch.setattr(