@@ -91,10 +91,9 @@ async def test_call_tool_empty_command():
91
91
async def test_call_tool_with_directory (temp_test_dir , monkeypatch ):
92
92
"""Test command execution in a specific directory"""
93
93
monkeypatch .setenv ("ALLOW_COMMANDS" , "pwd" )
94
- result = await call_tool ("execute" , {
95
- "command" : ["pwd" ],
96
- "directory" : temp_test_dir
97
- })
94
+ result = await call_tool (
95
+ "execute" , {"command" : ["pwd" ], "directory" : temp_test_dir }
96
+ )
98
97
assert len (result ) == 1
99
98
assert isinstance (result [0 ], TextContent )
100
99
assert result [0 ].type == "text"
@@ -112,17 +111,13 @@ async def test_call_tool_with_file_operations(temp_test_dir, monkeypatch):
112
111
f .write ("test content" )
113
112
114
113
# Test ls command
115
- result = await call_tool ("execute" , {
116
- "command" : ["ls" ],
117
- "directory" : temp_test_dir
118
- })
114
+ result = await call_tool ("execute" , {"command" : ["ls" ], "directory" : temp_test_dir })
119
115
assert "test.txt" in result [0 ].text
120
116
121
117
# Test cat command
122
- result = await call_tool ("execute" , {
123
- "command" : ["cat" , "test.txt" ],
124
- "directory" : temp_test_dir
125
- })
118
+ result = await call_tool (
119
+ "execute" , {"command" : ["cat" , "test.txt" ], "directory" : temp_test_dir }
120
+ )
126
121
assert result [0 ].text .strip () == "test content"
127
122
128
123
@@ -131,10 +126,9 @@ async def test_call_tool_with_nonexistent_directory(monkeypatch):
131
126
"""Test command execution with a non-existent directory"""
132
127
monkeypatch .setenv ("ALLOW_COMMANDS" , "ls" )
133
128
with pytest .raises (RuntimeError ) as excinfo :
134
- await call_tool ("execute" , {
135
- "command" : ["ls" ],
136
- "directory" : "/nonexistent/directory"
137
- })
129
+ await call_tool (
130
+ "execute" , {"command" : ["ls" ], "directory" : "/nonexistent/directory" }
131
+ )
138
132
assert "Directory does not exist: /nonexistent/directory" in str (excinfo .value )
139
133
140
134
@@ -149,10 +143,7 @@ async def test_call_tool_with_file_as_directory(temp_test_dir, monkeypatch):
149
143
f .write ("test content" )
150
144
151
145
with pytest .raises (RuntimeError ) as excinfo :
152
- await call_tool ("execute" , {
153
- "command" : ["ls" ],
154
- "directory" : test_file
155
- })
146
+ await call_tool ("execute" , {"command" : ["ls" ], "directory" : test_file })
156
147
assert f"Not a directory: { test_file } " in str (excinfo .value )
157
148
158
149
@@ -166,8 +157,5 @@ async def test_call_tool_with_nested_directory(temp_test_dir, monkeypatch):
166
157
os .mkdir (nested_dir )
167
158
nested_real_path = os .path .realpath (nested_dir )
168
159
169
- result = await call_tool ("execute" , {
170
- "command" : ["pwd" ],
171
- "directory" : nested_dir
172
- })
160
+ result = await call_tool ("execute" , {"command" : ["pwd" ], "directory" : nested_dir })
173
161
assert result [0 ].text .strip () == nested_real_path
0 commit comments