Create a minimal test environment.
()
| 195 | |
| 196 | |
| 197 | def create_test_environment(): |
| 198 | """Create a minimal test environment.""" |
| 199 | print("\n6. Creating Test Environment") |
| 200 | print("-" * 29) |
| 201 | |
| 202 | # Create minimal working config |
| 203 | test_config = { |
| 204 | "mcpServers": { |
| 205 | "sqlite": { |
| 206 | "command": "mcp-server-sqlite", |
| 207 | "args": ["--db-path", "./test.db"], |
| 208 | } |
| 209 | }, |
| 210 | "toolSettings": {"defaultTimeout": 300.0, "maxConcurrency": 4}, |
| 211 | } |
| 212 | |
| 213 | with open("test_config.json", "w") as f: |
| 214 | json.dump(test_config, f, indent=2) |
| 215 | |
| 216 | print(" ✅ Created test_config.json") |
| 217 | |
| 218 | # Create test script |
| 219 | test_script = f"""#!/usr/bin/env python3 |
| 220 | import os |
| 221 | import sys |
| 222 | sys.path.insert(0, 'src') |
| 223 | |
| 224 | os.environ['MCP_TOOL_TIMEOUT'] = '300' |
| 225 | |
| 226 | import subprocess |
| 227 | result = subprocess.run([ |
| 228 | '{sys.executable}', '-m', 'mcp_cli', 'chat', |
| 229 | '--config', 'test_config.json' |
| 230 | ], env=os.environ) |
| 231 | """ |
| 232 | |
| 233 | with open("test_mcp_cli.py", "w") as f: |
| 234 | f.write(test_script) |
| 235 | |
| 236 | print(" ✅ Created test_mcp_cli.py") |
| 237 | print("\n 🚀 Run test with: python test_mcp_cli.py") |
| 238 | |
| 239 | |
| 240 | def main(): |