b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
from unittest.mock import patch
|
|
|
|
|
|
def testcheck_via_pypi_detects_update():
|
|
"""check_via_pypi returns 1 when PyPI has newer version."""
|
|
from hermes_cli.banner import check_via_pypi
|
|
with patch("hermes_cli.banner.VERSION", "0.12.0"):
|
|
with patch("hermes_cli.banner._fetch_pypi_latest", return_value="0.13.0"):
|
|
result = check_via_pypi()
|
|
assert result == 1
|
|
|
|
|
|
def testcheck_via_pypi_up_to_date():
|
|
"""check_via_pypi returns 0 when versions match."""
|
|
from hermes_cli.banner import check_via_pypi
|
|
with patch("hermes_cli.banner.VERSION", "0.13.0"):
|
|
with patch("hermes_cli.banner._fetch_pypi_latest", return_value="0.13.0"):
|
|
result = check_via_pypi()
|
|
assert result == 0
|
|
|
|
|
|
def testcheck_via_pypi_network_failure():
|
|
"""check_via_pypi returns None on network error."""
|
|
from hermes_cli.banner import check_via_pypi
|
|
with patch("hermes_cli.banner._fetch_pypi_latest", return_value=None):
|
|
result = check_via_pypi()
|
|
assert result is None
|
|
|
|
|
|
def test_version_tuple_comparison():
|
|
"""Version comparison works with multi-segment versions."""
|
|
from hermes_cli.banner import _version_tuple
|
|
assert _version_tuple("0.13.0") > _version_tuple("0.12.0")
|
|
assert _version_tuple("0.13.0") == _version_tuple("0.13.0")
|
|
assert _version_tuple("1.0.0") > _version_tuple("0.99.99")
|