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): cover Lume python preflight (#4306)

Iflaq khurshid2ca90d33857f
diff --git a/libs/cua-driver/scripts/tests/test_macos_lume_runner.py b/libs/cua-driver/scripts/tests/test_macos_lume_runner.py
index d3c1283bdb..1ebf5a4fa1 100644
--- a/libs/cua-driver/scripts/tests/test_macos_lume_runner.py
+++ b/libs/cua-driver/scripts/tests/test_macos_lume_runner.py
@@ -182,6 +182,32 @@ def test_status_match_rejects_the_wrong_mode_and_a_failing_cli(tmp_path: Path) -
assert expected in completed.stdout
+def test_golden_image_preflight_requires_python3(tmp_path: Path) -> None:
+ fake_bin = tmp_path / "bin"
+ for command in (
+ "cargo",
+ "codesign",
+ "ffmpeg",
+ "ffprobe",
+ "jq",
+ "node",
+ "npm",
+ "osascript",
+ "security",
+ "xcrun",
+ ):
+ _write_executable(fake_bin / command, "exit 0\n")
+
+ completed = _run(
+ RUN_ALL,
+ 'PATH="$TEST_FAKE_BIN"\nrequire_golden_image_dependencies\n',
+ env={"TEST_FAKE_BIN": str(fake_bin)},
+ )
+
+ assert completed.returncode == 2
+ assert completed.stderr == "Missing golden-image dependency: python3\n"
+
+
@pytest.mark.parametrize("script", [RUN_ALL, RUN_RUST_E2E], ids=lambda path: path.name)
def test_no_permission_mode_check_pipes_into_grep(script: Path) -> None:
text = script.read_text(encoding="utf-8")
diff --git a/libs/cua-driver/tests/runners/macos-lume/run-all.sh b/libs/cua-driver/tests/runners/macos-lume/run-all.sh
index 7d27413d84..7b8f13466c 100755
--- a/libs/cua-driver/tests/runners/macos-lume/run-all.sh
+++ b/libs/cua-driver/tests/runners/macos-lume/run-all.sh
@@ -188,6 +188,15 @@ output_contains() {
[[ "${CAPTURED_OUTPUT}" == *"${needle}"* ]]
}
+require_golden_image_dependencies() {
+ for command_name in cargo codesign ffmpeg ffprobe jq node npm osascript python3 security xcrun; do
+ command -v "${command_name}" >/dev/null 2>&1 || {
+ echo "Missing golden-image dependency: ${command_name}" >&2
+ return 2
+ }
+ done
+}
+
run_bounded_command() {
command -v python3 >/dev/null 2>&1 || {
echo "Missing golden-image dependency: python3" >&2
@@ -917,12 +926,7 @@ if [[ "${SIP_STATUS}" != *"System Integrity Protection status: disabled."* ]]; t
exit 2
fi
-for command_name in cargo codesign ffmpeg ffprobe jq node npm osascript python3 security xcrun; do
- command -v "${command_name}" >/dev/null 2>&1 || {
- echo "Missing golden-image dependency: ${command_name}" >&2
- exit 2
- }
-done
+require_golden_image_dependencies || exit $?
if [[ ! -f "${SIGNING_KEYCHAIN}" ]]; then
echo "Missing golden-image signing keychain: ${SIGNING_KEYCHAIN}" >&2