The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: assert platform gate on declared data, not a sys.platform fake
teknium18fb12bc814dd
diff --git a/tests/skills/test_skill_platform_gates.py b/tests/skills/test_skill_platform_gates.pyindex dbe2c3b2a65..0a8bf068231 100644--- a/tests/skills/test_skill_platform_gates.py+++ b/tests/skills/test_skill_platform_gates.py@@ -1,14 +1,15 @@"""Platform gates of optional skills whose bodies are bound to one OS family.Front-matter ``platforms`` feeds skill selection, so a declared platform the-body cannot run on gets the skill offered and failing at step one. Driven-through the real loader (``agent.skill_utils``), not a frontmatter re-parse.+body cannot run on gets the skill offered and failing at step one. Asserts on+the declared data through the real frontmatter parser (``agent.skill_utils``)+instead of faking the host OS (tests/conftest.py host-marker policy)."""from pathlib import Pathimport pytest-from agent.skill_utils import parse_frontmatter, skill_matches_platform+from agent.skill_utils import PLATFORM_MAP, parse_frontmatterREPO = Path(__file__).resolve().parents[2]@@ -16,13 +17,16 @@ REPO = Path(__file__).resolve().parents[2]@pytest.mark.parametrize(("skill", "platform", "why"),[- ("optional-skills/creative/heartmula", "win32", ". .venv/bin/activate"),- ("optional-skills/mlops/tensorrt-llm", "darwin", "Requires CUDA"),+ ("optional-skills/creative/heartmula", "windows", ". .venv/bin/activate"),+ ("optional-skills/mlops/tensorrt-llm", "macos", "Requires CUDA"),],)-def test_os_bound_skill_is_not_offered_on_the_wrong_platform(monkeypatch, skill, platform, why):+def test_os_bound_skill_is_not_offered_on_the_wrong_platform(skill, platform, why):fm, body = parse_frontmatter((REPO / skill / "SKILL.md").read_text(encoding="utf-8"))assert why in body, f"{skill}: body no longer carries the OS-binding step; re-evaluate its platforms"- monkeypatch.setattr("agent.skill_utils.sys.platform", platform)- monkeypatch.setattr("agent.skill_utils.is_termux", lambda: False)- assert not skill_matches_platform(fm), f"{skill} declares a platform its body cannot run on: {platform}"+ declared = fm.get("platforms")+ assert declared, f"{skill}: an OS-bound body needs an explicit platforms list"+ declared = {PLATFORM_MAP.get(str(p).lower().strip(), str(p).lower().strip()) for p in declared}+ assert PLATFORM_MAP.get(platform, platform) not in declared, (+ f"{skill} declares a platform its body cannot run on: {platform}"+ )