fix: replace hardcoded contributor paths in __main__ blocks
Replace /home/chris/... absolute paths with Path(__file__)-relative equivalents in wire_manager.py and pin_locator.py so the test scripts work on any machine. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -418,21 +418,23 @@ if __name__ == "__main__":
|
|||||||
# Test pin location discovery
|
# Test pin location discovery
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, "/home/chris/MCP/KiCAD-MCP-Server/python")
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from commands.component_schematic import ComponentManager
|
from commands.component_schematic import ComponentManager
|
||||||
from commands.schematic import SchematicManager
|
from commands.schematic import SchematicManager
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
print("PIN LOCATOR TEST")
|
print("PIN LOCATOR TEST")
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
|
|
||||||
# Create test schematic with components (cross-platform temp directory)
|
# Create test schematic with components (cross-platform temp directory)
|
||||||
test_path = Path(tempfile.gettempdir()) / "test_pin_locator.kicad_sch"
|
test_path = Path(tempfile.gettempdir()) / "test_pin_locator.kicad_sch"
|
||||||
template_path = Path(
|
template_path = (
|
||||||
"/home/chris/MCP/KiCAD-MCP-Server/python/templates/template_with_symbols_expanded.kicad_sch"
|
Path(__file__).parent.parent
|
||||||
|
/ "templates"
|
||||||
|
/ "template_with_symbols_expanded.kicad_sch"
|
||||||
)
|
)
|
||||||
|
|
||||||
shutil.copy(template_path, test_path)
|
shutil.copy(template_path, test_path)
|
||||||
|
|||||||
@@ -706,20 +706,18 @@ if __name__ == "__main__":
|
|||||||
# Test wire creation
|
# Test wire creation
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, "/home/chris/MCP/KiCAD-MCP-Server/python")
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
print("WIRE MANAGER TEST")
|
print("WIRE MANAGER TEST")
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
|
|
||||||
# Create test schematic (cross-platform temp directory)
|
# Create test schematic (cross-platform temp directory)
|
||||||
test_path = Path(tempfile.gettempdir()) / "test_wire_manager.kicad_sch"
|
test_path = Path(tempfile.gettempdir()) / "test_wire_manager.kicad_sch"
|
||||||
template_path = Path(
|
template_path = Path(__file__).parent.parent / "templates" / "empty.kicad_sch"
|
||||||
"/home/chris/MCP/KiCAD-MCP-Server/python/templates/empty.kicad_sch"
|
|
||||||
)
|
|
||||||
|
|
||||||
shutil.copy(template_path, test_path)
|
shutil.copy(template_path, test_path)
|
||||||
print(f"\n✓ Created test schematic: {test_path}")
|
print(f"\n✓ Created test schematic: {test_path}")
|
||||||
|
|||||||
Reference in New Issue
Block a user