From 5c5a5c3d98aa1ed70153eb31a363e92b41fa1761 Mon Sep 17 00:00:00 2001 From: appel_c Date: Thu, 22 Jan 2026 08:45:35 +0100 Subject: [PATCH] test: add test for controller to call destroy controller.off --- tests/tests_devices/test_galil.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/tests_devices/test_galil.py b/tests/tests_devices/test_galil.py index dc0ed68..841f4f4 100644 --- a/tests/tests_devices/test_galil.py +++ b/tests/tests_devices/test_galil.py @@ -207,6 +207,15 @@ def test_wait_for_connection_called(): motor.wait_for_connection(timeout=5.0) assert mock_on.call_args_list[-1] == mock.call(timeout=5.0) + + # Make sure destroy calls controller off + + with mock.patch.object(motor.controller, "off") as mock_off: + motor.destroy() + assert mock_off.call_count == 1 + assert mock_off.call_args_list[0] == mock.call(update_config=False) + assert motor._destroyed is True + finally: controller_cls._reset_controller() controller_cls._axes_per_controller = ctrl_axis_backup