Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

test(cua-driver): isolate uninstall autostart process discovery (#3854)

injaneity1c554ede0c5a
diff --git a/libs/cua-driver/scripts/tests/test_uninstall_autostart.py b/libs/cua-driver/scripts/tests/test_uninstall_autostart.py
index 4cdba89dda..7689adaba9 100644
--- a/libs/cua-driver/scripts/tests/test_uninstall_autostart.py
+++ b/libs/cua-driver/scripts/tests/test_uninstall_autostart.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import os
from pathlib import Path
+import shutil
import subprocess
import pytest
@@ -22,7 +23,13 @@ def _sandbox(tmp_path: Path, os_name: str) -> tuple[Path, Path, dict[str, str]]:
calls = tmp_path / "calls.log"
home.mkdir()
fake_bin.mkdir()
+ for command in ("cat", "dirname", "id", "readlink", "realpath", "sleep"):
+ executable = shutil.which(command, path=os.defpath)
+ assert executable is not None, f"missing fixture utility: {command}"
+ (fake_bin / command).symlink_to(executable)
+ _write_executable(fake_bin / "pgrep", "exit 1\n")
+ _write_executable(fake_bin / "ps", "exit 2\n")
_write_executable(fake_bin / "uname", f"printf '%s\\n' '{os_name}'\n")
for command in ("launchctl", "systemctl", "tccutil", "sudo"):
_write_executable(
@@ -53,21 +60,13 @@ done
""",
)
- env = os.environ.copy()
- env.update(
- {
- "HOME": str(home),
- "PATH": f"{fake_bin}:/usr/bin:/bin",
- }
- )
- env.pop("CUA_DRIVER_HOME", None)
- env.pop("CUA_DRIVER_RS_HOME", None)
+ env = {"HOME": str(home), "PATH": str(fake_bin)}
return home, calls, env
def _run_uninstall(env: dict[str, str]) -> subprocess.CompletedProcess[str]:
result = subprocess.run(
- ["/bin/bash", str(UNINSTALL)],
+ ["/bin/bash", str(UNINSTALL), "--keep-tcc"],
cwd=REPO_ROOT,
env=env,
text=True,