hermes-agent/tests/tools
Teknium caded0a5e7
fix: repair 57 failing CI tests across 14 files (#5823)
* fix: repair 57 failing CI tests across 14 files

Categories of fixes:

**Test isolation under xdist (-n auto):**
- test_hermes_logging: Strip ALL RotatingFileHandlers before each test
  to prevent handlers leaked from other xdist workers from polluting counts
- test_code_execution: Force TERMINAL_ENV=local in setUp — prevents Modal
  AuthError when another test leaks TERMINAL_ENV=modal
- test_timezone: Same TERMINAL_ENV fix for execute_code timezone tests
- test_codex_execution_paths: Mock _resolve_turn_agent_config to ensure
  model resolution works regardless of xdist worker state

**Matrix adapter tests (nio not installed in CI):**
- Add _make_fake_nio() helper with real response classes for isinstance()
  checks in production code
- Replace MagicMock(spec=nio.XxxResponse) with fake_nio instances
- Wrap production method calls with patch.dict('sys.modules', {'nio': ...})
  so import nio succeeds in method bodies
- Use try/except instead of pytest.importorskip for nio.crypto imports
  (importorskip can be fooled by MagicMock in sys.modules)
- test_matrix_voice: Skip entire file if nio is a mock, not just missing

**Stale test expectations:**
- test_cli_provider_resolution: _prompt_provider_choice now takes **kwargs
  (default param added); mock getpass.getpass alongside input
- test_anthropic_oauth_flow: Mock getpass.getpass (code switched from input)
- test_gemini_provider: Mock models.dev + OpenRouter API lookups to test
  hardcoded defaults without external API variance
- test_code_execution: Add notify_on_complete to blocked terminal params
- test_setup_openclaw_migration: Mock prompt_choice to select 'Full setup'
  (new quick-setup path leads to _require_tty → sys.exit in CI)
- test_skill_manager_tool: Patch get_all_skills_dirs alongside SKILLS_DIR
  so _find_skill searches tmp_path, not real ~/.hermes/skills/

**Missing attributes in object.__new__ test runners:**
- test_platform_reconnect: Add session_store to _make_runner()
- test_session_race_guard: Add hooks, _running_agents_ts, session_store,
  delivery_router to _make_runner()

**Production bug fix (gateway/run.py):**
- Fix sentinel eviction race: _AGENT_PENDING_SENTINEL was immediately
  evicted by the stale-detection logic because sentinels have no
  get_activity_summary() method, causing _stale_idle=inf >= timeout.
  Guard _should_evict with 'is not _AGENT_PENDING_SENTINEL'.

* fix: address remaining CI failures

- test_setup_openclaw_migration: Also mock _offer_launch_chat (called at
  end of both quick and full setup paths)
- test_code_execution: Move TERMINAL_ENV=local to module level to protect
  ALL test classes (TestEnvVarFiltering, TestExecuteCodeEdgeCases,
  TestInterruptHandling, TestHeadTailTruncation) from xdist env leaks
- test_matrix: Use try/except for nio.crypto imports (importorskip can be
  fooled by MagicMock in sys.modules under xdist)
2026-04-07 09:58:45 -07:00
..
__init__.py
test_ansi_strip.py
test_approval.py fix(gateway): isolate approval session key per turn 2026-04-03 17:50:01 -07:00
test_browser_camofox_persistence.py
test_browser_camofox_state.py feat(tools): add Firecrawl cloud browser provider (#5628) 2026-04-07 02:35:26 +05:30
test_browser_camofox.py
test_browser_cdp_override.py feat: switch managed browser provider from Browserbase to Browser Use (#5750) 2026-04-07 08:40:22 -04:00
test_browser_cleanup.py refactor: remove browser_close tool — auto-cleanup handles it (#5792) 2026-04-07 03:28:44 -07:00
test_browser_console.py
test_browser_content_none_guard.py
test_browser_homebrew_paths.py
test_browser_secret_exfil.py
test_browser_ssrf_local.py
test_checkpoint_manager.py
test_clarify_tool.py
test_clipboard.py
test_code_execution.py fix: repair 57 failing CI tests across 14 files (#5823) 2026-04-07 09:58:45 -07:00
test_command_guards.py
test_config_null_guard.py
test_credential_files.py feat: wire skills.external_dirs into all remaining discovery paths 2026-04-03 21:14:42 -07:00
test_cron_prompt_injection.py
test_cronjob_tools.py
test_daytona_environment.py
test_debug_helpers.py
test_delegate_toolset_scope.py
test_delegate.py fix(delegate): share credential pools with subagents + per-task leasing 2026-04-06 23:01:11 -07:00
test_docker_environment.py feat: add docker_env config for explicit container environment variables (#4738) 2026-04-03 23:30:12 -07:00
test_docker_find.py
test_env_passthrough.py
test_file_operations.py
test_file_read_guards.py
test_file_staleness.py
test_file_tools_live.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_file_tools.py
test_file_write_safety.py
test_force_dangerous_override.py
test_fuzzy_match.py
test_hidden_dir_filter.py
test_homeassistant_tool.py
test_interrupt.py
test_llm_content_none_guard.py
test_local_env_blocklist.py
test_local_persistent.py
test_managed_browserbase_and_modal.py feat: switch managed browser provider from Browserbase to Browser Use (#5750) 2026-04-07 08:40:22 -04:00
test_managed_media_gateways.py
test_managed_modal_environment.py
test_managed_tool_gateway.py feat: switch managed browser provider from Browserbase to Browser Use (#5750) 2026-04-07 08:40:22 -04:00
test_mcp_dynamic_discovery.py
test_mcp_oauth.py feat: implement MCP OAuth 2.1 PKCE client support (#5420) 2026-04-05 22:08:00 -07:00
test_mcp_probe.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_mcp_stability.py
test_mcp_tool_issue_948.py fix: remove stale test skips, fix regex backtracking, file search bug, and test flakiness 2026-04-04 10:18:57 -07:00
test_mcp_tool.py
test_memory_tool.py
test_mixture_of_agents_tool.py
test_modal_sandbox_fixes.py
test_modal_snapshot_isolation.py
test_notify_on_complete.py feat: notify_on_complete for background processes (#5779) 2026-04-07 02:40:16 -07:00
test_osv_check.py feat: OSV malware check for MCP extension packages (#5305) 2026-04-05 12:46:07 -07:00
test_parse_env_var.py
test_patch_parser.py
test_process_registry.py
test_read_loop_detection.py
test_registry.py
test_rl_training_tool.py
test_search_hidden_dirs.py
test_send_message_missing_platforms.py fix(tools): redact query secrets in send_message errors 2026-04-06 16:49:52 -07:00
test_send_message_tool.py fix(tools): redact query secrets in send_message errors 2026-04-06 16:49:52 -07:00
test_session_search.py
test_singularity_preflight.py
test_skill_env_passthrough.py
test_skill_improvements.py
test_skill_manager_tool.py fix: repair 57 failing CI tests across 14 files (#5823) 2026-04-07 09:58:45 -07:00
test_skill_size_limits.py
test_skill_view_path_check.py
test_skill_view_traversal.py
test_skills_guard.py
test_skills_hub_clawhub.py
test_skills_hub.py
test_skills_sync.py
test_skills_tool.py
test_ssh_environment.py
test_symlink_prefix_confusion.py
test_terminal_disk_usage.py
test_terminal_exit_semantics.py feat: add exit code context for common CLI tools in terminal results (#5144) 2026-04-04 16:57:24 -07:00
test_terminal_requirements.py
test_terminal_timeout_output.py
test_terminal_tool_requirements.py
test_tirith_security.py
test_todo_tool.py
test_transcription_tools.py
test_transcription.py
test_url_safety.py
test_vision_tools.py
test_voice_cli_integration.py
test_voice_mode.py
test_web_tools_config.py
test_web_tools_tavily.py
test_website_policy.py
test_windows_compat.py
test_write_deny.py
test_yolo_mode.py