unity-mcp/Server/tests/integration
dsarno 39bff4ae27
Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554)
* Fix test job state management after domain reload

- TestRunnerService.RunFinished: Always clean up job state even when
  _runCompletionSource is null (happens after PlayMode domain reload)
- TestJobManager: Detect and clear stale jobs (5+ min without updates)
  on startup to recover from stuck state after domain reload
- refresh_unity.py: Add "could not connect" to retryable errors when
  wait_for_ready=True, so connection failures during domain reload
  trigger waiting instead of immediate failure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add focus nudge to handle OS-level throttling during PlayMode tests

When Unity is unfocused, macOS App Nap (and similar OS features) can
throttle the process, causing PlayMode tests to stall even with Unity
No Throttling mode enabled.

Changes:
- Add ApplyNoThrottlingPreemptive() to TestRunnerNoThrottle for early
  throttle prevention before PlayMode Execute()
- Add focus_nudge.py utility that temporarily focuses Unity and returns
  focus to the original app (supports macOS, Windows, Linux)
- Integrate focus nudge into get_test_job polling - when tests appear
  stalled (unfocused + no progress for 10s), automatically nudge Unity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix code review issues in focus_nudge.py

- Remove redundant time import (already imported at module level)
- Escape window titles in PowerShell script to prevent injection
- Remove unused Callable import

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Improve focus nudge logging and fix skipped tests

- Improve logging in focus_nudge.py: rate limit skip and focus return at INFO level
- Improve logging in run_tests.py: show nudge completion status
- Fix path resolution in test_logging_stdout.py and test_transport_framing.py
- Add PlayMode tests to UnityMCPTests project for testing PlayMode runner

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add troubleshooting note about focus permission requests

When running PlayMode tests with Unity in the background, the focus
nudge feature may trigger OS permission prompts (especially on macOS
for accessibility/automation). Document this expected behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:02:40 -08:00
..
__init__.py Update mirror backend with latest code 2025-11-05 16:08:59 -04:00
conftest.py 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
test_debug_request_context_diagnostics.py Payload-safe paging for hierarchy/components + safer asset search + docs (#490) 2025-12-28 20:57:57 -08:00
test_domain_reload_resilience.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_edit_normalization_and_noop.py Clean up Unity and Python tests (#548) 2026-01-11 20:26:20 -08:00
test_edit_strict_and_warnings.py Clean up Unity and Python tests (#548) 2026-01-11 20:26:20 -08:00
test_editor_state_v2_contract.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
test_external_changes_scanner.py Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
test_find_gameobjects.py 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
test_gameobject_resources.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
test_get_sha.py Clean up Unity and Python tests (#548) 2026-01-11 20:26:20 -08:00
test_helpers.py Clean up Unity and Python tests (#548) 2026-01-11 20:26:20 -08:00
test_improved_anchor_matching.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_instance_autoselect.py ManageGameObject/Material + auto-select sole Unity instance (#502) 2026-01-01 21:04:10 -08:00
test_instance_routing_comprehensive.py Clean up Unity and Python tests (#548) 2026-01-11 20:26:20 -08:00
test_instance_targeting_resolution.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_json_parsing_simple.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_logging_stdout.py Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554) 2026-01-14 15:02:40 -08:00
test_manage_asset_json_parsing.py 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
test_manage_asset_param_coercion.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_manage_components.py 🎮 GameObject Toolset Redesign and Streamlining (#518) 2026-01-06 10:13:45 -08:00
test_manage_gameobject_param_coercion.py 🔧 Clean up & Consolidate Shared Services Across MCP Tools (#519) 2026-01-06 12:58:17 -08:00
test_manage_scene_paging_params.py Payload-safe paging for hierarchy/components + safer asset search + docs (#490) 2025-12-28 20:57:57 -08:00
test_manage_script_uri.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
test_manage_scriptable_object_tool.py Harden `manage_scriptable_object` Tool (#522) 2026-01-07 10:46:35 -04:00
test_read_console_truncate.py Codex/optimize and paginate read console tool (#511) 2026-01-04 14:46:52 -08:00
test_read_resource_minimal.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_refresh_unity_registration.py Async Test Infrastructure & Editor Readiness Status + new refresh_unity tool (#507) 2026-01-03 12:42:32 -08:00
test_refresh_unity_retry_recovery.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
test_run_tests_async.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
test_script_tools.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00
test_telemetry_endpoint_validation.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_telemetry_queue_worker.py Clean up Unity and Python tests (#548) 2026-01-11 20:26:20 -08:00
test_telemetry_subaction.py HTTP Server, uvx, C# only custom tools (#375) 2025-11-24 23:21:06 -04:00
test_tool_signatures_paging.py Payload-safe paging for hierarchy/components + safer asset search + docs (#490) 2025-12-28 20:57:57 -08:00
test_transport_framing.py Fix PlayMode tests stalling when unfocused (python refresh utility), improve domain reload recovery and refresh tool (#554) 2026-01-14 15:02:40 -08:00
test_validate_script_summary.py v9 pre-release pruning (#528) 2026-01-07 18:51:51 -04:00