Files
hermes-agent/tests/pm/test_cua_driver_package.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

58 lines
2.5 KiB
Python

"""CUA archive staging preserves the native host payload, without running it."""
import tarfile
import zipfile
import pytest
from pm import Lockfile, Store, get_package, paths
@pytest.mark.parametrize("target", ["darwin-arm64", "darwin-x64"])
def test_macos_cua_selects_bundle_binary_and_preserves_signature(tmp_path, target):
package = get_package("cua-driver")
lock = Lockfile(paths.lockfile_path())
version = lock.version(package.name)
assert version is not None
payload = tmp_path / "payload"
app = payload / "CuaDriver.app"
members = {
"cua-driver": b"standalone executable fixture",
"CuaDriver.app/Contents/MacOS/cua-driver": b"bundle executable fixture",
"CuaDriver.app/Contents/MacOS/cua-cursor-theme": b"cursor helper fixture",
"CuaDriver.app/Contents/Info.plist": b"bundle metadata fixture",
"CuaDriver.app/Contents/_CodeSignature/CodeResources": b"signature fixture",
}
for name, content in members.items():
file = payload / name
file.parent.mkdir(parents=True, exist_ok=True)
file.write_bytes(content)
archive = tmp_path / "cua.tar.gz"
with tarfile.open(archive, "w:gz") as tar:
tar.add(payload, arcname="cua-release")
staged = tmp_path / "staged"
package.unpack(archive, staged, target)
package.stage(Store(tmp_path / "store"), staged, version, target)
assert package.binary(staged, target) == staged / app.relative_to(payload) / "Contents/MacOS/cua-driver"
for name, content in members.items():
assert (staged / name).read_bytes() == content
assert lock.artifacts(package.name, target)[0]["url"] == package.fetch_url(version, target)
assert "-binary.tar.gz" not in package.fetch_url(version, target)
def test_windows_cua_keeps_uiaccess_and_cursor_helpers(tmp_path):
package = get_package("cua-driver")
archive = tmp_path / "cua.zip"
members = {name: name.encode() for name in (
"cua-driver.exe", "cua-driver-uia.exe", "cua-cursor-theme.exe", "cua_driver_sdk.dll",
)}
with zipfile.ZipFile(archive, "w") as zipped:
for name, content in members.items():
zipped.writestr(name, content)
staged = tmp_path / "staged"
package.unpack(archive, staged, "win32-x64")
package.stage(Store(tmp_path / "store"), staged, "fixture", "win32-x64")
assert package.binary(staged, "win32-x64") == staged / "cua-driver.exe"
for name, content in members.items():
assert (staged / name).read_bytes() == content