From a55f8bf705dee05c9da116984b4fae622d4e2b9e Mon Sep 17 00:00:00 2001 From: appel_c Date: Mon, 20 Jan 2025 13:46:24 +0100 Subject: [PATCH] test: fix ScanStatusMessage --- tests/tests_devices/test_mo1_bragg.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/tests_devices/test_mo1_bragg.py b/tests/tests_devices/test_mo1_bragg.py index 90f11f9..174c463 100644 --- a/tests/tests_devices/test_mo1_bragg.py +++ b/tests/tests_devices/test_mo1_bragg.py @@ -149,6 +149,7 @@ def test_set_xas_settings(mock_bragg): assert dev.scan_settings.s_scan_angle_hi.get() == 20 assert dev.scan_settings.s_scan_scantime.get() == 1 + def test_set_xrd_settings(mock_bragg): dev = mock_bragg dev.set_xrd_settings( @@ -170,6 +171,7 @@ def test_set_xrd_settings(mock_bragg): assert dev.scan_settings.xrd_every_n_lo.get() == 1 assert dev.scan_settings.xrd_every_n_hi.get() == 5 + def test_set_control_settings(mock_bragg): dev = mock_bragg dev.set_scan_control_settings(mode=ScanControlMode.SIMPLE, scan_duration=10) @@ -281,7 +283,13 @@ def test_unstage(mock_bragg): scan_type="monitor_scan", parameter={ "args": {}, - "kwargs": {"device": "mo1_bragg", "start": 0, "stop": 10, "relative": True}, + "kwargs": { + "device": "mo1_bragg", + "start": 0, + "stop": 10, + "relative": True, + "system_config": {"file_suffix": None, "file_directory": None}, + }, "num_points": 100, }, queue="primary", @@ -297,6 +305,7 @@ def test_unstage(mock_bragg): "stop": 10, "scan_time": 1, "scan_duration": 10, + "system_config": {"file_suffix": None, "file_directory": None}, }, "num_points": 100, }, @@ -321,6 +330,7 @@ def test_unstage(mock_bragg): "exp_time_high": 3, "cycle_low": 1, "cycle_high": 5, + "system_config": {"file_suffix": None, "file_directory": None}, }, "num_points": 10, }, @@ -339,6 +349,7 @@ def test_unstage(mock_bragg): "scan_duration": 10, "p_kink": 50, "e_kink": 8500, + "system_config": {"file_suffix": None, "file_directory": None}, }, "num_points": 100, }, @@ -365,6 +376,7 @@ def test_unstage(mock_bragg): "exp_time_high": 3, "cycle_low": 1, "cycle_high": 5, + "system_config": {"file_suffix": None, "file_directory": None}, }, "num_points": 10, }, @@ -409,7 +421,12 @@ def test_stage(mock_bragg, scan_worker_mock, msg): ): scan_name = scan_status_msg.content["info"].get("scan_name", "") # Chek the not implemented fly scan first, should raise Mo1BraggError - if scan_name not in ["xas_simple_scan", "xas_simple_scan_with_xrd", "xas_advanced_scan", "xas_advanced_scan_with_xrd"]: + if scan_name not in [ + "xas_simple_scan", + "xas_simple_scan_with_xrd", + "xas_advanced_scan", + "xas_advanced_scan_with_xrd", + ]: with pytest.raises(Mo1BraggError): mock_bragg.stage() assert mock_check_scan_msg.call_count == 1 @@ -417,7 +434,9 @@ def test_stage(mock_bragg, scan_worker_mock, msg): else: with ( mock.patch.object(mock_bragg, "set_xas_settings") as mock_xas_settings, - mock.patch.object(mock_bragg, "set_advanced_xas_settings") as mock_advanced_xas_settings, + mock.patch.object( + mock_bragg, "set_advanced_xas_settings" + ) as mock_advanced_xas_settings, mock.patch.object(mock_bragg, "set_xrd_settings") as mock_xrd_settings, mock.patch.object( mock_bragg, "set_scan_control_settings" @@ -538,4 +557,4 @@ def test_stage(mock_bragg, scan_worker_mock, msg): scan_duration=scan_status_msg.content["info"]["kwargs"][ "scan_duration" ], - ) \ No newline at end of file + )