mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-05-30 00:20:41 +02:00
test: fix tests
This commit is contained in:
parent
c2201e5e33
commit
2f2e519772
@ -154,14 +154,10 @@ def test_prepare_detector(mock_GrashopperSetup, scaninfo):
|
|||||||
def test_prepare_detector_backend(mock_GrashopperSetup):
|
def test_prepare_detector_backend(mock_GrashopperSetup):
|
||||||
"""Test the prepare_detector_backend method."""
|
"""Test the prepare_detector_backend method."""
|
||||||
# Call the function you want to test
|
# Call the function you want to test
|
||||||
with mock.patch.object(mock_GrashopperSetup, "run_monitor") as mock_run_monitor:
|
mock_GrashopperSetup.prepare_detector_backend()
|
||||||
mock_GrashopperSetup.prepare_detector_backend()
|
mock_GrashopperSetup.parent.image.set_array_counter.put.assert_called_once_with(0)
|
||||||
|
assert mock_GrashopperSetup.monitor_thread is None
|
||||||
# Assert the correct methods are called with the expected arguments
|
assert not mock_GrashopperSetup.stop_monitor
|
||||||
mock_GrashopperSetup.parent.image.set_array_counter.put.assert_called_once_with(0)
|
|
||||||
assert mock_GrashopperSetup.monitor_thread is None
|
|
||||||
assert not mock_GrashopperSetup.stop_monitor
|
|
||||||
mock_run_monitor.assert_called_once()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("detector_state", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
@pytest.mark.parametrize("detector_state", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||||
@ -187,11 +183,13 @@ def test_on_trigger(mock_GrashopperSetup, trigger_source):
|
|||||||
"""Test the on_trigger method."""
|
"""Test the on_trigger method."""
|
||||||
# Call the function you want to test
|
# Call the function you want to test
|
||||||
mock_GrashopperSetup.parent.cam.trigger_source.get.return_value = trigger_source
|
mock_GrashopperSetup.parent.cam.trigger_source.get.return_value = trigger_source
|
||||||
mock_GrashopperSetup.on_trigger()
|
with mock.patch.object(mock_GrashopperSetup, "send_data") as mock_send_data:
|
||||||
|
mock_GrashopperSetup.on_trigger()
|
||||||
|
|
||||||
# Assert the correct methods are called with the expected arguments
|
# Assert the correct methods are called with the expected arguments
|
||||||
if trigger_source == TriggerSource.SOFTWARE:
|
if trigger_source == TriggerSource.SOFTWARE:
|
||||||
mock_GrashopperSetup.parent.cam.software_trigger.put.assert_called_once_with(1)
|
mock_GrashopperSetup.parent.cam.software_trigger_device.put.assert_called_once_with(1)
|
||||||
|
assert mock_send_data.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_set_acquisition_params(mock_GrashopperSetup, scaninfo):
|
def test_set_acquisition_params(mock_GrashopperSetup, scaninfo):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user