MCPcopy Create free account
hub / github.com/IBM/mcp-cli / create_test_environment

Function create_test_environment

diagnostics/mcp_cli_diagnostics.py:197–237  ·  view source on GitHub ↗

Create a minimal test environment.

()

Source from the content-addressed store, hash-verified

195
196
197def 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
220import os
221import sys
222sys.path.insert(0, 'src')
223
224os.environ['MCP_TOOL_TIMEOUT'] = '300'
225
226import subprocess
227result = 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
240def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected