mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-25 05:52:34 +00:00
refactor: DRY cleanup from code review
- dep_ensure.py: use get_hermes_home() instead of hand-rolled env var - dep_ensure.py: add "chrome" to browser name list (was inconsistent with browser_tool.py) - main.py _cmd_update_check: use detect_install_method() directly instead of redundant .git check - main.py _cmd_update_pip: build command list directly instead of fragile split() on display string - banner.py: rename _check_via_pypi → check_via_pypi (cross-module public API)
This commit is contained in:
parent
164a77dec9
commit
47c0efe1c0
5 changed files with 39 additions and 36 deletions
|
|
@ -1,29 +1,29 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
|
||||
def test_check_via_pypi_detects_update():
|
||||
"""_check_via_pypi returns 1 when PyPI has newer version."""
|
||||
from hermes_cli.banner import _check_via_pypi
|
||||
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()
|
||||
result = check_via_pypi()
|
||||
assert result == 1
|
||||
|
||||
|
||||
def test_check_via_pypi_up_to_date():
|
||||
"""_check_via_pypi returns 0 when versions match."""
|
||||
from hermes_cli.banner import _check_via_pypi
|
||||
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()
|
||||
result = check_via_pypi()
|
||||
assert result == 0
|
||||
|
||||
|
||||
def test_check_via_pypi_network_failure():
|
||||
"""_check_via_pypi returns None on network error."""
|
||||
from hermes_cli.banner import _check_via_pypi
|
||||
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()
|
||||
result = check_via_pypi()
|
||||
assert result is None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue