Files
kicad-mcp-server/test/test_schematic_manager.py
KiCAD MCP Bot e4c7119c51 feat: Week 1 complete - Linux support + IPC API prep
🎉 Major v2.0 rebuild kickoff - Week 1 accomplished!

## Highlights

### Cross-Platform Support 🌍
-  Linux primary platform (Ubuntu/Debian tested)
-  Windows fully supported
-  macOS experimental support
-  Platform-agnostic path handling (XDG spec)
-  Auto-detection of KiCAD installation

### Infrastructure 🏗️
-  GitHub Actions CI/CD pipeline
-  Pytest framework with 20+ tests
-  Pre-commit hooks (Black, MyPy, ESLint)
-  Automated Linux installation script
-  Enhanced npm scripts

### IPC API Migration Prep 🚀
-  Comprehensive migration plan (30 pages)
-  Backend abstraction layer (800+ lines)
-  Factory pattern with auto-detection
-  SWIG backward compatibility wrapper
-  IPC backend skeleton ready

### Documentation 📚
-  Updated README (Linux installation)
-  CONTRIBUTING.md guide
-  Linux compatibility audit
-  IPC API migration plan
-  Session summaries
-  Platform-specific config templates

## Files Changed

- 27 files created
- ~3,000 lines of code/docs
- 8 comprehensive documentation pages
- 20+ unit tests
- 5 abstraction layer modules

## Next Steps

- Week 2: IPC API migration (project.py → component.py → routing.py)
- Migrate from deprecated SWIG to official IPC API
- JLCPCB/Digikey integration prep

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 20:48:00 -04:00

83 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""
Test script for the schematic manager implementation using KiCAD python
"""
import sys
import os
import traceback
# Add the parent directory to the module search path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
def main():
"""Test the SchematicManager functions"""
print("=== Testing SchematicManager functionality ===")
try:
# Set up test output directory
test_dir = os.path.join(os.path.dirname(__file__), 'schematic_test_output')
if not os.path.exists(test_dir):
os.makedirs(test_dir)
print("Test directory:", test_dir)
# Import our SchematicManager
print("Importing SchematicManager...")
from python.commands.schematic import SchematicManager
print("Successfully imported SchematicManager")
# Create a new schematic
print("\nCreating new schematic...")
schematic_name = "TestSchemManager"
metadata = {
"description": "Test schematic",
"author": "Test script"
}
sch = SchematicManager.create_schematic(schematic_name, metadata)
print("Successfully created schematic object")
# Save the schematic
schematic_path = os.path.join(test_dir, f"{schematic_name}.kicad_sch")
print(f"\nSaving schematic to: {schematic_path}")
success = SchematicManager.save_schematic(sch, schematic_path)
if success:
print(f"Successfully saved schematic to: {schematic_path}")
else:
print("Failed to save schematic")
return
# Load the schematic
print("\nLoading schematic from file...")
loaded_sch = SchematicManager.load_schematic(schematic_path)
if loaded_sch:
print("Successfully loaded schematic")
# Get metadata
print("\nGetting schematic metadata...")
metadata = SchematicManager.get_schematic_metadata(loaded_sch)
print(f"Metadata: {metadata}")
else:
print("Failed to load schematic")
# Verify the file exists
if os.path.exists(schematic_path):
print(f"\nSCHEMATIC TEST SUCCESSFUL: File created at: {schematic_path}")
print(f"File size: {os.path.getsize(schematic_path)} bytes")
else:
print(f"\nERROR: File not found at: {schematic_path}")
except ImportError as e:
print(f"ERROR: Failed to import required modules: {e}")
traceback.print_exc()
except Exception as e:
print(f"ERROR: An unexpected error occurred: {e}")
traceback.print_exc()
print("\n=== Test completed ===")
if __name__ == "__main__":
main()