hermes-agent/tests/pm/test_lazy_install_policy.py
ethernet 5e4a2a3d24 refactor(pm): remove legacy dependency and launch managers
Competing installers and checkout-local venv assumptions bypassed PM
selection, install consent, and generation lifetimes. Route consumers
through PM and installation-bound launchers. Refresh source launchers
before obsolete Python entries can be collected.

Remove Node, browser, and CUA acquisition engines, obsolete venv-holder
handling, detached sync, and unused PM APIs. Keep historical updater
exports inert and preserve external tool ownership and native integration.

Share product freshness and prepared inputs across builders. Align plugin
admission, Docker provisioning, setup instructions, and behavioral tests.

Verified targeted Python and JavaScript tests, desktop and web typechecks,
scoped lint, real product builds, and the Docker frontend smoke test.
The missed post-setup test cleanup is included and verified.

Native Windows/macOS execution, full Rust compilation, and the complete
repository suite remain unverified. Historical compatibility requirements
were preserved and extended, not fully rescanned.
2026-09-12 14:57:38 -04:00

30 lines
1.1 KiB
Python

"""PM reads boolean install policy from real config, without CLI output."""
import pytest
import pm
from hermes_cli.config import get_config_path
@pytest.mark.parametrize("content,expected", [
("{}\n", True),
("security:\n allow_lazy_installs: true\n", True),
("security:\n allow_lazy_installs: false\n", False),
("security:\n allow_lazy_installs: 'false'\n", False),
("security: [\n", False),
])
def test_real_policy_is_boolean_and_fails_closed(monkeypatch, capsys, content, expected):
monkeypatch.delenv("HERMES_DISABLE_LAZY_INSTALLS", raising=False)
config = get_config_path()
config.write_text(content, encoding="utf-8")
assert pm.lazy_installs_allowed() is expected
assert capsys.readouterr().out == ""
assert config.read_text(encoding="utf-8") == content
def test_internal_disable_overrides_enabled_config(monkeypatch):
get_config_path().write_text("security:\n allow_lazy_installs: true\n", encoding="utf-8")
monkeypatch.setenv("HERMES_DISABLE_LAZY_INSTALLS", "1")
assert not pm.lazy_installs_allowed()