From a6b4f92e4bdeb14b31ddc640a33d1c54f3a1ef0c Mon Sep 17 00:00:00 2001 From: Michael Parment Date: Tue, 28 Apr 2026 13:38:12 +0200 Subject: [PATCH] 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. --- tests/test_rotate_schematic_mirror.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_rotate_schematic_mirror.py b/tests/test_rotate_schematic_mirror.py index 04ffae3..dba2c03 100644 --- a/tests/test_rotate_schematic_mirror.py +++ b/tests/test_rotate_schematic_mirror.py @@ -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()