mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-10-30 19:51:59 +01:00
fix: ensure exact tags resolve correctly in version fetching logic
This commit is contained in:
1 parent
d0a34d16e2
commit
fd2571b6e7
2 files changed
+9
No files matched your search
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user