From ba1b600bce79b63e9e3c4b7d3c1fd7721b931025 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 29 Mar 2026 07:51:43 -0700 Subject: [PATCH] fix(tests): align skill/setup and platform mocks with current behavior (#3721) - Skill invocation: no secret capture callback so SSH remote setup note is emitted - Patch agent.skill_utils.sys for platform checks (skill_matches_platform) - Skip CLAUDE.md priority test on Darwin (case-insensitive FS) Made-with: Cursor Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> --- tests/agent/test_prompt_builder.py | 13 ++++++++----- tests/agent/test_skill_commands.py | 12 +----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.py index a5b8be529..eba85d033 100644 --- a/tests/agent/test_prompt_builder.py +++ b/tests/agent/test_prompt_builder.py @@ -5,6 +5,8 @@ import importlib import logging import sys +import pytest + from agent.prompt_builder import ( _scan_context_content, _truncate_content, @@ -194,7 +196,7 @@ class TestParseSkillFile: ) from unittest.mock import patch - with patch("tools.skills_tool.sys") as mock_sys: + with patch("agent.skill_utils.sys") as mock_sys: mock_sys.platform = "linux" is_compat, _, _ = _parse_skill_file(skill_file) assert is_compat is False @@ -234,9 +236,6 @@ class TestPromptBuilderImports: # ========================================================================= -import pytest - - class TestBuildSkillsSystemPrompt: @pytest.fixture(autouse=True) def _clear_skills_cache(self): @@ -296,7 +295,7 @@ class TestBuildSkillsSystemPrompt: from unittest.mock import patch - with patch("tools.skills_tool.sys") as mock_sys: + with patch("agent.skill_utils.sys") as mock_sys: mock_sys.platform = "linux" result = build_skills_system_prompt() @@ -574,6 +573,10 @@ class TestBuildContextFilesPrompt: result = build_context_files_prompt(cwd=str(tmp_path)) assert "Lowercase claude rules" in result + @pytest.mark.skipif( + sys.platform == "darwin", + reason="APFS default volume is case-insensitive; CLAUDE.md and claude.md alias the same path", + ) def test_claude_md_uppercase_takes_priority(self, tmp_path): (tmp_path / "CLAUDE.md").write_text("From uppercase.") (tmp_path / "claude.md").write_text("From lowercase.") diff --git a/tests/agent/test_skill_commands.py b/tests/agent/test_skill_commands.py index 1f18d9bf4..6b3e551e1 100644 --- a/tests/agent/test_skill_commands.py +++ b/tests/agent/test_skill_commands.py @@ -246,20 +246,10 @@ Generate some audio. def test_preserves_remaining_remote_setup_warning(self, tmp_path, monkeypatch): monkeypatch.setenv("TERMINAL_ENV", "ssh") monkeypatch.delenv("TENOR_API_KEY", raising=False) - - def fake_secret_callback(var_name, prompt, metadata=None): - os.environ[var_name] = "stored-in-test" - return { - "success": True, - "stored_as": var_name, - "validated": False, - "skipped": False, - } - monkeypatch.setattr( skills_tool_module, "_secret_capture_callback", - fake_secret_callback, + None, raising=False, )