Files
hermes-agent/tests/hermes_cli/test_verify_console_scripts.py
ethernet 8b7eae99ef fix(pm): own interpreter selection and dependency recovery
Pin uv and uvx to the PM interpreter instead of ambient Python discovery.
A matching dependency stamp cannot prove that installed files still exist.
Repair now rebuilds the recorded workspace and lock in a fresh generation,
checks startup imports, and publishes the selection only after success.

Run startup recovery before dependency activation. Keep manual PM repair
reachable when the selected environment is damaged. Preserve plugin
selection, retry ownership, and the previous generation on failure.
Remove the separate pip, ensurepip, per-extra, and install-time quarantine
ladders. Keep orphan launcher restoration.

Verification: 717 targeted tests passed on native Windows ARM64, with
56 skipped. Ruff, diff checks, and the source-scoped compat check passed.
A disposable real Hermes install recovered deleted YAML and dotenv files,
then printed CLI help with exit 0. Its lock and stamp stayed unchanged.
The full suite and a release build were not run for this change.
2026-09-08 23:39:55 -04:00

51 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
@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