fix: clean failed UIAutomator2 startups before retrying

This commit is contained in:
chenmingxuan committed 2026-10-12 10:58:47 +08:00
1 parent 4d6560dbd4
commit 3fbcdfefea
4 files changed
+304 -5

No files matched your search

+6 -3
View File
@@ -6,7 +6,7 @@ from artemis.clients.ui_automator_client import UIAutomatorClient
from artemis.drivers.android.adb_driver import AndroidAdbDriver
@patch("artemis.clients.ui_automator_client.u2.connect")
@patch("artemis.clients.ui_automator_client._ManagedUIAutomatorDevice")
@patch(
"artemis.clients.ui_automator_client.ensure_device_awake",
return_value="host_heartbeat",
@@ -25,7 +25,10 @@ def test_new_ui_connection_enrolls_device_in_shared_awake_strategy(
mock_connect.assert_called_once_with("device-123")
@patch("artemis.clients.ui_automator_client.u2.connect", side_effect=RuntimeError("offline"))
@patch(
"artemis.clients.ui_automator_client._ManagedUIAutomatorDevice",
side_effect=RuntimeError("offline"),
)
@patch(
"artemis.clients.ui_automator_client.ensure_device_awake",
return_value="host_heartbeat",
@@ -43,7 +46,7 @@ def test_failed_ui_connection_does_not_stop_process_awake_service(
assert client._awake_strategy is None
@patch("artemis.clients.ui_automator_client.u2.connect")
@patch("artemis.clients.ui_automator_client._ManagedUIAutomatorDevice")
@patch(
"artemis.clients.ui_automator_client.ensure_device_awake",
return_value="host_heartbeat",