fix: stub annotations module and add python/ to sys.path in smoke test

Upstream added `from annotations import AnnotationLoader` and moved
`from commands.wire_manager import WireManager` to module-level in
kicad_interface.py. The smoke test now stubs annotations and ensures
python/ is on sys.path so commands.* imports resolve without installing.
This commit is contained in:
Michael Parment
2026-04-28 13:38:12 +02:00
parent 7cafbda127
commit a6b4f92e4b

View File

@@ -181,9 +181,15 @@ def test_pin_positions_mirror_x_flips_x():
def test_rotate_handler_no_crash(tmp_path):
"""_handle_rotate_schematic_component should succeed without kicad-skip."""
# Ensure python/ is on sys.path so commands.* imports resolve
_python_dir = os.path.join(os.path.dirname(__file__), "..", "python")
if _python_dir not in sys.path:
sys.path.insert(0, _python_dir)
# Stub heavy imports before loading kicad_interface
for modname in ("pcbnew", "skip", "resources", "schemas",
"resources.resource_definitions", "schemas.tool_schemas"):
"resources.resource_definitions", "schemas.tool_schemas",
"annotations"):
sys.modules.setdefault(modname, MagicMock())
sys.modules["resources.resource_definitions"].RESOURCE_DEFINITIONS = {}
sys.modules["resources.resource_definitions"].handle_resource_read = MagicMock()