Files
hermes-agent/tests/hermes_cli/test_verify_console_scripts.py
teknium1 e692d61d19 test: restore update self-lock, quarantine and repair guards dropped by #120071
Restored (OS fakes replaced by windows_only/macos_only markers):
- test_update_shim_self_lock.py: venv/.venv scripts dir lookup (#79542, all OSes); Windows shim detection (argv0, zipapp, ancestor chain, foreign install ignored), re-exec hand-off under venv python without recursion or on spawn failure, dependency-sync guard (shim-only vs native lock).
- test_update_concurrent_quarantine.py: concurrent-parent detection robust to one bad hop and excludes launcher/self (#29341, #34795); quarantine success/unbreakable lock; Windows gateway pause/resume, service rollback and retryable resume failures, abort on indeterminate discovery; venv launcher ancestor detection; concurrent gate gateway-only skip vs non-gateway abort; refusal to tree-kill the gateway ancestor (#98814).
- test_update_apply_shallow_count.py (recreated): real _prepare_checkout_for_update on full vs depth-1 clones — shallow behind-count recovered via compare API, unknown offline, never bogus (#53479, #86257).
- test_lazy_refresh_venv_repair.py: venv repair reinstalls lazy/tool snapshots through an isolated uv env (#83914).
- test_verify_console_scripts.py (recreated, windows_only): missing hermes.exe triggers reinstall; still-missing shim reported, no reinstall when all present (#52931).
- test_macos_fda_guidance.py (recreated): doctor/setup Full Disk Access guidance granted/denied/indeterminate, silent off macOS (#52010).
2026-09-23 10:34:54 -07:00

53 lines
1.3 KiB
Python

"""Orphan launcher discovery follows the declared console script names."""
from __future__ import annotations
import textwrap
import pytest
from hermes_cli import main_install_repair
pytestmark = pytest.mark.platforms("windows")
@pytest.fixture
def temp_pyproject(tmp_path, monkeypatch):
pyproject = tmp_path / "pyproject.toml"
pyproject.write_text(
textwrap.dedent(
"""\
[project]
name = "fake"
version = "0.0.0"
[project.scripts]
hermes = "hermes_cli.main:main"
hermes-agent = "run_agent:main"
hermes-acp = "acp_adapter.entry:main"
"""
)
)
import hermes_cli.main as main_mod
monkeypatch.setattr(main_mod, "PROJECT_ROOT", tmp_path)
return tmp_path
@pytest.fixture
def fake_scripts_dir(tmp_path):
scripts = tmp_path / "venv" / "Scripts"
scripts.mkdir(parents=True)
return scripts
class TestHermesExeShims:
"""The orphan sweep includes declared scripts and the legacy gateway shim."""
def test_shims_include_declared_console_scripts(
self, temp_pyproject, fake_scripts_dir
):
names = {path.name for path in main_install_repair._hermes_exe_shims(fake_scripts_dir)}
assert {"hermes.exe", "hermes-agent.exe", "hermes-acp.exe"} <= names
assert "hermes-gateway.exe" in names