diff --git a/tests/unit/gui/test_main_window.py b/tests/unit/gui/test_main_window.py index 6a901043..8e79c9be 100644 --- a/tests/unit/gui/test_main_window.py +++ b/tests/unit/gui/test_main_window.py @@ -1,3 +1,4 @@ +from typing import cast from unittest.mock import MagicMock, patch import pytest @@ -105,16 +106,18 @@ def test_main_window_init(qtbot, mock_ui_state, daq_status_factory): == "Manual collection stopped: detector error." ) - # Manual unmount respects the hutch PSS gate. + # Manual unmount respects the hutch PSS gate. cast: win.daq is a + # patched-in MagicMock, but pyright sees the real DAQWorker type. + unmount_mock = cast(MagicMock, win.daq.unmount) with ( patch.object(win, "_hutch_blocks_mount", return_value="hutch open"), patch("aare.gui.main_window.QMessageBox"), ): win._on_manual_unmount_requested() - win.daq.unmount.assert_not_called() + unmount_mock.assert_not_called() with patch.object(win, "_hutch_blocks_mount", return_value=None): win._on_manual_unmount_requested() - win.daq.unmount.assert_called_once() + unmount_mock.assert_called_once() # Motion watch: only the robot station switches to the combined # beamline view. Moving no longer does (users kept losing the sample