File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88import os
99from pathlib import Path
10+ import stat
1011from unittest .mock import patch
1112
1213import pytest
@@ -84,13 +85,20 @@ def test_returns_none_when_no_version(self, tmp_path: Path) -> None:
8485class TestIsToolInstalled :
8586 """Test the two-signal tool detection logic."""
8687
87- def test_detected_via_binary_on_path (self ) -> None :
88+ def test_detected_via_binary_on_path (self , tmp_path : Path , monkeypatch : pytest .MonkeyPatch ) -> None :
89+ bin_dir = tmp_path / "bin"
90+ bin_dir .mkdir ()
91+ binary = bin_dir / "fake-tool.exe"
92+ binary .touch ()
93+ binary .chmod (binary .stat ().st_mode | stat .S_IXUSR )
94+ monkeypatch .setenv ("PATH" , str (bin_dir ))
95+
8896 target = SkillTarget (
8997 name = "fake-tool" ,
9098 description = "T" ,
9199 user_dir = Path ("/nonexistent/skills" ),
92100 project_dir = ".fake/skills" ,
93- binary = "python3" ,
101+ binary = binary . name ,
94102 root_dirs = [],
95103 )
96104 assert _is_tool_installed (target ) is True
You can’t perform that action at this time.
0 commit comments