Skip to content

Commit 0a2d822

Browse files
authored
Update test_filesystem.py
1 parent 69d2a7d commit 0a2d822

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎tests/test_filesystem.py‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from python_agent_harness.tools.base import ToolContext, ToolRuntime
1616
from python_agent_harness.tools.diffapply import apply_unified_diff, diff_targets
1717
from python_agent_harness.tools.edit_mac import EditMac
18+
from python_agent_harness.tools.edit_win import EditWindows
1819
from python_agent_harness.tools.filesystem import (
1920
Edit,
2021
GlobTool,
@@ -27,26 +28,36 @@
2728
_strip_diff_fence,
2829
)
2930
from python_agent_harness.tools.glob_mac import GlobMac
31+
from python_agent_harness.tools.glob_win import GlobWindows
3032
from python_agent_harness.tools.grep_mac import GrepMac
33+
from python_agent_harness.tools.grep_win import GrepWindows
3134

3235

3336
def edit_tool() -> Edit:
3437
"""The Edit tool active on this platform: Linux uses the patch
3538
binary, macOS the built-in Python diff applier (Apple's BSD patch
36-
rejects well-formed hunks that GNU patch accepts)."""
39+
rejects well-formed hunks that GNU patch accepts), Windows the
40+
pure-Python applier."""
41+
if sys.platform == "win32":
42+
return EditWindows()
3743
return EditMac() if sys.platform == "darwin" else Edit()
3844

3945

4046
def glob_tool() -> GlobTool:
4147
"""The Glob tool active on this platform: Linux shells out to
4248
``tree`` for the non-git fallback, macOS to ``find`` (Apple ships
43-
no ``tree``)."""
49+
no ``tree``), Windows uses pure-Python ``pathlib.rglob``."""
50+
if sys.platform == "win32":
51+
return GlobWindows()
4452
return GlobMac() if sys.platform == "darwin" else GlobTool()
4553

4654

4755
def grep_tool() -> Grep:
4856
"""The Grep tool active on this platform: Linux uses
49-
``git grep -P``, macOS ``git grep -E`` (Apple's git lacks PCRE)."""
57+
``git grep -P``, macOS ``git grep -E`` (Apple's git lacks PCRE),
58+
Windows the pure-Python fallback."""
59+
if sys.platform == "win32":
60+
return GrepWindows()
5061
return GrepMac() if sys.platform == "darwin" else Grep()
5162

5263

0 commit comments

Comments
 (0)