@@ -91,10 +91,9 @@ async def test_call_tool_empty_command():
9191async def test_call_tool_with_directory (temp_test_dir , monkeypatch ):
9292 """Test command execution in a specific directory"""
9393 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+ )
9897 assert len (result ) == 1
9998 assert isinstance (result [0 ], TextContent )
10099 assert result [0 ].type == "text"
@@ -112,17 +111,13 @@ async def test_call_tool_with_file_operations(temp_test_dir, monkeypatch):
112111 f .write ("test content" )
113112
114113 # 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 })
119115 assert "test.txt" in result [0 ].text
120116
121117 # 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+ )
126121 assert result [0 ].text .strip () == "test content"
127122
128123
@@ -131,10 +126,9 @@ async def test_call_tool_with_nonexistent_directory(monkeypatch):
131126 """Test command execution with a non-existent directory"""
132127 monkeypatch .setenv ("ALLOW_COMMANDS" , "ls" )
133128 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+ )
138132 assert "Directory does not exist: /nonexistent/directory" in str (excinfo .value )
139133
140134
@@ -149,10 +143,7 @@ async def test_call_tool_with_file_as_directory(temp_test_dir, monkeypatch):
149143 f .write ("test content" )
150144
151145 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 })
156147 assert f"Not a directory: { test_file } " in str (excinfo .value )
157148
158149
@@ -166,8 +157,5 @@ async def test_call_tool_with_nested_directory(temp_test_dir, monkeypatch):
166157 os .mkdir (nested_dir )
167158 nested_real_path = os .path .realpath (nested_dir )
168159
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 })
173161 assert result [0 ].text .strip () == nested_real_path
0 commit comments