From f0dce1182455867cc4752d81cf43fbc8d419aca0 Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Mon, 16 Nov 2026 12:37:20 -0800 Subject: [PATCH] test(computer): an app's readiness check is compared with its seconds waited masked Co-Authored-By: Claude Opus 5.5 --- .../tests/test_computer_app_server.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/agentenv-protocol/tests/test_computer_app_server.py b/packages/agentenv-protocol/tests/test_computer_app_server.py index aa2e6ffb3..10cb9ad65 100644 --- a/packages/agentenv-protocol/tests/test_computer_app_server.py +++ b/packages/agentenv-protocol/tests/test_computer_app_server.py @@ -7,9 +7,11 @@ import asyncio import contextlib +import dataclasses import importlib.util import json import os +import re import shlex import signal import socket @@ -281,20 +283,27 @@ async def test_the_driver_asks_each_apps_server_on_the_socket_in_its_folder(desk shown.append({"instance": "music", "class": "Music", "title": "Library"}) playing = await apps.check(Path(root) / "music") - assert first == [ + assert [_seconds_masked(check) for check in first] == [ ReadyCheck("app broken", False, "its server failed to start: RuntimeError: no mailbox"), ReadyCheck("app gone", False, "its server isn't answering yet"), - ReadyCheck("app mail", False, "not ready yet, 0 s in: not launched yet; no window with class 'Mail'; " + ReadyCheck("app mail", False, "not ready yet, N s in: not launched yet; no window with class 'Mail'; " "@ready_check inbox_synced returned False"), ReadyCheck("app music", True, "its server answers; it launches on demand"), ReadyCheck("app sync", True, "ready"), ] assert late.detail.startswith("not ready after 30 s: not launched yet") assert launched == [(["music"], Path.cwd(), {"ENVIRONMENT_NAME": "music"})] - assert opened == ReadyCheck("app music", False, "not ready yet, 0 s in: no window with class 'Music'") + assert _seconds_masked(opened) == ReadyCheck("app music", False, + "not ready yet, N s in: no window with class 'Music'") assert playing == ReadyCheck("app music", True, "ready") +def _seconds_masked(check: ReadyCheck) -> ReadyCheck: + """The check with the seconds it has waited masked: they count real time since its server started or its app + launched, which a busy runner stretches past the half second that rounds to 0.""" + return dataclasses.replace(check, detail=re.sub(r"\d+ s in", "N s in", check.detail)) + + @pytest.mark.asyncio async def test_the_drivers_readiness_asks_every_apps_server_at_once(desktop, monkeypatch): pytest.importorskip("PIL")