bec-ipython-client 3.64.5__py3-none-any.whl → 3.89.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bec-ipython-client might be problematic. Click here for more details.
- .gitignore +3 -0
- PKG-INFO +2 -2
- bec_ipython_client/callbacks/device_progress.py +11 -6
- bec_ipython_client/callbacks/ipython_live_updates.py +49 -19
- bec_ipython_client/callbacks/live_table.py +36 -9
- bec_ipython_client/callbacks/move_device.py +121 -59
- bec_ipython_client/callbacks/utils.py +5 -23
- bec_ipython_client/main.py +83 -14
- bec_ipython_client/signals.py +9 -3
- {bec_ipython_client-3.64.5.dist-info → bec_ipython_client-3.89.3.dist-info}/METADATA +2 -2
- bec_ipython_client-3.89.3.dist-info/RECORD +44 -0
- {bec_ipython_client-3.64.5.dist-info → bec_ipython_client-3.89.3.dist-info}/WHEEL +1 -1
- demo.py +2 -1
- pyproject.toml +2 -2
- tests/client_tests/conftest.py +19 -0
- tests/client_tests/test_bec_client.py +32 -1
- tests/client_tests/test_ipython_live_updates.py +259 -68
- tests/client_tests/test_live_table.py +33 -12
- tests/client_tests/test_move_callback.py +112 -70
- tests/end-2-end/_ensure_requirements_container.py +5 -5
- tests/end-2-end/test_procedures_e2e.py +36 -26
- tests/end-2-end/test_scans_e2e.py +62 -13
- tests/end-2-end/test_scans_lib_e2e.py +23 -19
- bec_ipython_client-3.64.5.dist-info/RECORD +0 -43
- {bec_ipython_client-3.64.5.dist-info → bec_ipython_client-3.89.3.dist-info}/entry_points.txt +0 -0
|
@@ -7,34 +7,94 @@ from bec_lib import messages
|
|
|
7
7
|
from bec_lib.queue_items import QueueItem
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
@pytest.
|
|
11
|
-
def
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
def queue_elements(bec_client_mock):
|
|
12
12
|
client = bec_client_mock
|
|
13
|
-
live_updates = IPythonLiveUpdates(client)
|
|
14
13
|
request_msg = messages.ScanQueueMessage(
|
|
15
14
|
scan_type="grid_scan",
|
|
16
15
|
parameter={"args": {"samx": (-5, 5, 3)}, "kwargs": {}},
|
|
17
16
|
queue="primary",
|
|
18
17
|
metadata={"RID": "something"},
|
|
19
18
|
)
|
|
19
|
+
request_block = messages.RequestBlock(
|
|
20
|
+
msg=request_msg,
|
|
21
|
+
RID="req_id",
|
|
22
|
+
scan_motors=["samx"],
|
|
23
|
+
report_instructions=[],
|
|
24
|
+
readout_priority={"monitored": ["samx"]},
|
|
25
|
+
is_scan=True,
|
|
26
|
+
scan_number=1,
|
|
27
|
+
scan_id="scan_id",
|
|
28
|
+
)
|
|
20
29
|
queue = QueueItem(
|
|
21
30
|
scan_manager=client.queue,
|
|
22
31
|
queue_id="queue_id",
|
|
23
|
-
request_blocks=[
|
|
32
|
+
request_blocks=[request_block],
|
|
24
33
|
status="PENDING",
|
|
25
34
|
active_request_block={},
|
|
26
35
|
scan_id=["scan_id"],
|
|
27
36
|
)
|
|
28
|
-
|
|
37
|
+
return queue, request_block, request_msg
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@pytest.fixture
|
|
41
|
+
def sample_request_msg():
|
|
42
|
+
return messages.ScanQueueMessage(
|
|
43
|
+
scan_type="grid_scan",
|
|
44
|
+
parameter={"args": {"samx": (-5, 5, 3)}, "kwargs": {}},
|
|
45
|
+
queue="primary",
|
|
46
|
+
metadata={"RID": "something"},
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@pytest.fixture
|
|
51
|
+
def sample_request_block(sample_request_msg):
|
|
52
|
+
return messages.RequestBlock(
|
|
53
|
+
msg=sample_request_msg,
|
|
54
|
+
RID="req_id",
|
|
55
|
+
scan_motors=["samx"],
|
|
56
|
+
report_instructions=[],
|
|
57
|
+
readout_priority={"monitored": ["samx"]},
|
|
58
|
+
is_scan=True,
|
|
59
|
+
scan_number=1,
|
|
60
|
+
scan_id="scan_id",
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@pytest.fixture
|
|
65
|
+
def sample_queue_info_entry(sample_request_block):
|
|
66
|
+
return messages.QueueInfoEntry(
|
|
67
|
+
queue_id="test_queue_id",
|
|
68
|
+
scan_id=["scan_id"],
|
|
69
|
+
is_scan=[True],
|
|
70
|
+
request_blocks=[sample_request_block],
|
|
71
|
+
scan_number=[1],
|
|
72
|
+
status="RUNNING",
|
|
73
|
+
active_request_block=None,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@pytest.fixture
|
|
78
|
+
def sample_scan_queue_status(sample_queue_info_entry):
|
|
79
|
+
return messages.ScanQueueStatus(info=[sample_queue_info_entry], status="RUNNING")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@pytest.mark.timeout(20)
|
|
83
|
+
def test_live_updates_process_queue_pending(bec_client_mock, queue_elements):
|
|
84
|
+
client = bec_client_mock
|
|
85
|
+
live_updates = IPythonLiveUpdates(client)
|
|
86
|
+
queue, request_block, request_msg = queue_elements
|
|
87
|
+
|
|
88
|
+
client.queue.queue_storage.current_scan_queue = {
|
|
89
|
+
"primary": messages.ScanQueueStatus(info=[], status="RUNNING")
|
|
90
|
+
}
|
|
29
91
|
with mock.patch.object(queue, "_update_with_buffer"):
|
|
30
92
|
with mock.patch(
|
|
31
93
|
"bec_lib.queue_items.QueueItem.queue_position", new_callable=mock.PropertyMock
|
|
32
94
|
) as queue_pos:
|
|
33
95
|
queue_pos.return_value = 2
|
|
34
96
|
with mock.patch.object(
|
|
35
|
-
live_updates,
|
|
36
|
-
"_available_req_blocks",
|
|
37
|
-
return_value=[{"report_instructions": [], "content": {"scan_type": "grid_scan"}}],
|
|
97
|
+
live_updates, "_available_req_blocks", return_value=[request_block]
|
|
38
98
|
):
|
|
39
99
|
with mock.patch.object(live_updates, "_process_report_instructions") as process:
|
|
40
100
|
with mock.patch("builtins.print") as prt:
|
|
@@ -45,39 +105,30 @@ def test_live_updates_process_queue_pending(bec_client_mock):
|
|
|
45
105
|
|
|
46
106
|
|
|
47
107
|
@pytest.mark.timeout(20)
|
|
48
|
-
def test_live_updates_process_queue_running(bec_client_mock):
|
|
108
|
+
def test_live_updates_process_queue_running(bec_client_mock, queue_elements):
|
|
49
109
|
client = bec_client_mock
|
|
50
110
|
live_updates = IPythonLiveUpdates(client)
|
|
51
|
-
request_msg =
|
|
52
|
-
scan_type="grid_scan",
|
|
53
|
-
parameter={"args": {"samx": (-5, 5, 3)}, "kwargs": {}},
|
|
54
|
-
queue="primary",
|
|
55
|
-
metadata={"RID": "something"},
|
|
56
|
-
)
|
|
111
|
+
_, request_block, request_msg = queue_elements
|
|
57
112
|
queue = QueueItem(
|
|
58
113
|
scan_manager=client.queue,
|
|
59
114
|
queue_id="queue_id",
|
|
60
|
-
request_blocks=[
|
|
115
|
+
request_blocks=[request_block],
|
|
61
116
|
status="RUNNING",
|
|
62
117
|
active_request_block={},
|
|
63
118
|
scan_id=["scan_id"],
|
|
64
119
|
)
|
|
65
120
|
live_updates._active_request = request_msg
|
|
66
|
-
|
|
121
|
+
request_block.report_instructions = [{"wait_table": 10}]
|
|
122
|
+
client.queue.queue_storage.current_scan_queue = {
|
|
123
|
+
"primary": messages.ScanQueueStatus(info=[], status="RUNNING")
|
|
124
|
+
}
|
|
67
125
|
with mock.patch.object(queue, "_update_with_buffer"):
|
|
68
126
|
with mock.patch(
|
|
69
127
|
"bec_lib.queue_items.QueueItem.queue_position", new_callable=mock.PropertyMock
|
|
70
128
|
) as queue_pos:
|
|
71
129
|
queue_pos.return_value = 2
|
|
72
130
|
with mock.patch.object(
|
|
73
|
-
live_updates,
|
|
74
|
-
"_available_req_blocks",
|
|
75
|
-
return_value=[
|
|
76
|
-
{
|
|
77
|
-
"report_instructions": [{"wait_table": 10}],
|
|
78
|
-
"content": {"scan_type": "grid_scan"},
|
|
79
|
-
}
|
|
80
|
-
],
|
|
131
|
+
live_updates, "_available_req_blocks", return_value=[request_block]
|
|
81
132
|
):
|
|
82
133
|
with mock.patch.object(live_updates, "_process_instruction") as process:
|
|
83
134
|
with mock.patch("builtins.print") as prt:
|
|
@@ -88,37 +139,19 @@ def test_live_updates_process_queue_running(bec_client_mock):
|
|
|
88
139
|
|
|
89
140
|
|
|
90
141
|
@pytest.mark.timeout(20)
|
|
91
|
-
def test_live_updates_process_queue_without_status(bec_client_mock):
|
|
142
|
+
def test_live_updates_process_queue_without_status(bec_client_mock, queue_elements):
|
|
92
143
|
client = bec_client_mock
|
|
93
144
|
live_updates = IPythonLiveUpdates(client)
|
|
94
|
-
request_msg =
|
|
95
|
-
scan_type="grid_scan",
|
|
96
|
-
parameter={"args": {"samx": (-5, 5, 3)}, "kwargs": {}},
|
|
97
|
-
queue="primary",
|
|
98
|
-
metadata={"RID": "something"},
|
|
99
|
-
)
|
|
100
|
-
queue = QueueItem(
|
|
101
|
-
scan_manager=client.queue,
|
|
102
|
-
queue_id="queue_id",
|
|
103
|
-
request_blocks=[request_msg],
|
|
104
|
-
status=None,
|
|
105
|
-
active_request_block={},
|
|
106
|
-
scan_id=["scan_id"],
|
|
107
|
-
)
|
|
145
|
+
queue, _, request_msg = queue_elements
|
|
108
146
|
with mock.patch.object(queue, "_update_with_buffer"):
|
|
109
147
|
assert live_updates._process_queue(queue, request_msg, "req_id") is False
|
|
110
148
|
|
|
111
149
|
|
|
112
150
|
@pytest.mark.timeout(20)
|
|
113
|
-
def test_live_updates_process_queue_without_queue_number(bec_client_mock):
|
|
151
|
+
def test_live_updates_process_queue_without_queue_number(bec_client_mock, queue_elements):
|
|
114
152
|
client = bec_client_mock
|
|
115
153
|
live_updates = IPythonLiveUpdates(client)
|
|
116
|
-
request_msg =
|
|
117
|
-
scan_type="grid_scan",
|
|
118
|
-
parameter={"args": {"samx": (-5, 5, 3)}, "kwargs": {}},
|
|
119
|
-
queue="primary",
|
|
120
|
-
metadata={"RID": "something"},
|
|
121
|
-
)
|
|
154
|
+
queue, _, request_msg = queue_elements
|
|
122
155
|
|
|
123
156
|
with mock.patch(
|
|
124
157
|
"bec_lib.queue_items.QueueItem.queue_position", new_callable=mock.PropertyMock
|
|
@@ -136,24 +169,182 @@ def test_live_updates_process_queue_without_queue_number(bec_client_mock):
|
|
|
136
169
|
assert live_updates._process_queue(queue, request_msg, "req_id") is False
|
|
137
170
|
|
|
138
171
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
#
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
#
|
|
150
|
-
|
|
151
|
-
#
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
@pytest.mark.timeout(20)
|
|
173
|
+
def test_available_req_blocks(bec_client_mock, queue_elements):
|
|
174
|
+
client = bec_client_mock
|
|
175
|
+
live_updates = IPythonLiveUpdates(client)
|
|
176
|
+
queue, request_block, request_msg = queue_elements
|
|
177
|
+
|
|
178
|
+
# Test with matching RID
|
|
179
|
+
available_blocks = live_updates._available_req_blocks(queue, request_msg)
|
|
180
|
+
assert (
|
|
181
|
+
len(available_blocks) == 0
|
|
182
|
+
) # request_block.RID is "req_id", request_msg.metadata["RID"] is "something"
|
|
183
|
+
|
|
184
|
+
# Test with correct RID
|
|
185
|
+
request_block.RID = "something"
|
|
186
|
+
available_blocks = live_updates._available_req_blocks(queue, request_msg)
|
|
187
|
+
assert len(available_blocks) == 1
|
|
188
|
+
assert available_blocks[0] == request_block
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@pytest.mark.timeout(20)
|
|
192
|
+
def test_available_req_blocks_multiple_blocks(bec_client_mock):
|
|
193
|
+
client = bec_client_mock
|
|
194
|
+
live_updates = IPythonLiveUpdates(client)
|
|
195
|
+
|
|
196
|
+
request_msg = messages.ScanQueueMessage(
|
|
197
|
+
scan_type="grid_scan",
|
|
198
|
+
parameter={"args": {"samx": (-5, 5, 3)}, "kwargs": {}},
|
|
199
|
+
queue="primary",
|
|
200
|
+
metadata={"RID": "test_rid"},
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
request_block1 = messages.RequestBlock(
|
|
204
|
+
msg=request_msg,
|
|
205
|
+
RID="test_rid",
|
|
206
|
+
scan_motors=["samx"],
|
|
207
|
+
report_instructions=[],
|
|
208
|
+
readout_priority={"monitored": ["samx"]},
|
|
209
|
+
is_scan=True,
|
|
210
|
+
scan_number=1,
|
|
211
|
+
scan_id="scan_id_1",
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
request_block2 = messages.RequestBlock(
|
|
215
|
+
msg=request_msg,
|
|
216
|
+
RID="test_rid",
|
|
217
|
+
scan_motors=["samy"],
|
|
218
|
+
report_instructions=[],
|
|
219
|
+
readout_priority={"monitored": ["samy"]},
|
|
220
|
+
is_scan=True,
|
|
221
|
+
scan_number=2,
|
|
222
|
+
scan_id="scan_id_2",
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
request_block3 = messages.RequestBlock(
|
|
226
|
+
msg=request_msg,
|
|
227
|
+
RID="different_rid",
|
|
228
|
+
scan_motors=["samz"],
|
|
229
|
+
report_instructions=[],
|
|
230
|
+
readout_priority={"monitored": ["samz"]},
|
|
231
|
+
is_scan=True,
|
|
232
|
+
scan_number=3,
|
|
233
|
+
scan_id="scan_id_3",
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
queue = QueueItem(
|
|
237
|
+
scan_manager=client.queue,
|
|
238
|
+
queue_id="queue_id",
|
|
239
|
+
request_blocks=[request_block1, request_block2, request_block3],
|
|
240
|
+
status="RUNNING",
|
|
241
|
+
active_request_block={},
|
|
242
|
+
scan_id=["scan_id_1", "scan_id_2", "scan_id_3"],
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
available_blocks = live_updates._available_req_blocks(queue, request_msg)
|
|
246
|
+
assert len(available_blocks) == 2
|
|
247
|
+
assert request_block1 in available_blocks
|
|
248
|
+
assert request_block2 in available_blocks
|
|
249
|
+
assert request_block3 not in available_blocks
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
@pytest.mark.timeout(20)
|
|
253
|
+
def test_element_in_queue_no_queue(bec_client_mock):
|
|
254
|
+
client = bec_client_mock
|
|
255
|
+
live_updates = IPythonLiveUpdates(client)
|
|
256
|
+
|
|
257
|
+
# Test when client.queue is None
|
|
258
|
+
client.queue = None
|
|
259
|
+
assert live_updates._element_in_queue() is False
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
@pytest.mark.timeout(20)
|
|
263
|
+
def test_element_in_queue_no_current_scan_queue(bec_client_mock):
|
|
264
|
+
client = bec_client_mock
|
|
265
|
+
live_updates = IPythonLiveUpdates(client)
|
|
266
|
+
|
|
267
|
+
# Test when current_scan_queue is None
|
|
268
|
+
client.queue.queue_storage.current_scan_queue = None
|
|
269
|
+
assert live_updates._element_in_queue() is False
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
@pytest.mark.timeout(20)
|
|
273
|
+
def test_element_in_queue_no_primary_queue(bec_client_mock):
|
|
274
|
+
client = bec_client_mock
|
|
275
|
+
live_updates = IPythonLiveUpdates(client)
|
|
276
|
+
|
|
277
|
+
# Test when primary queue doesn't exist
|
|
278
|
+
scan_queue_status = messages.ScanQueueStatus(info=[], status="RUNNING")
|
|
279
|
+
client.queue.queue_storage.current_scan_queue = {"secondary": scan_queue_status}
|
|
280
|
+
assert live_updates._element_in_queue() is False
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
@pytest.mark.timeout(20)
|
|
284
|
+
def test_element_in_queue_no_queue_info(bec_client_mock):
|
|
285
|
+
client = bec_client_mock
|
|
286
|
+
live_updates = IPythonLiveUpdates(client)
|
|
287
|
+
|
|
288
|
+
# Test when queue_info is empty
|
|
289
|
+
scan_queue_status = messages.ScanQueueStatus(info=[], status="RUNNING")
|
|
290
|
+
client.queue.queue_storage.current_scan_queue = {"primary": scan_queue_status}
|
|
291
|
+
assert live_updates._element_in_queue() is False
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
@pytest.mark.timeout(20)
|
|
295
|
+
def test_element_in_queue_no_current_queue(bec_client_mock, sample_scan_queue_status):
|
|
296
|
+
client = bec_client_mock
|
|
297
|
+
live_updates = IPythonLiveUpdates(client)
|
|
298
|
+
|
|
299
|
+
# Test when _current_queue is None
|
|
300
|
+
live_updates._current_queue = None
|
|
301
|
+
client.queue.queue_storage.current_scan_queue = {"primary": sample_scan_queue_status}
|
|
302
|
+
assert live_updates._element_in_queue() is False
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
@pytest.mark.timeout(20)
|
|
306
|
+
def test_element_in_queue_queue_id_not_in_info(bec_client_mock, sample_request_block):
|
|
307
|
+
client = bec_client_mock
|
|
308
|
+
live_updates = IPythonLiveUpdates(client)
|
|
309
|
+
|
|
310
|
+
# Test when queue_id is not in info
|
|
311
|
+
current_queue = mock.MagicMock()
|
|
312
|
+
current_queue.queue_id = "my_queue_id"
|
|
313
|
+
live_updates._current_queue = current_queue
|
|
314
|
+
|
|
315
|
+
queue_info_entry = messages.QueueInfoEntry(
|
|
316
|
+
queue_id="different_queue_id",
|
|
317
|
+
scan_id=["scan_id"],
|
|
318
|
+
is_scan=[True],
|
|
319
|
+
request_blocks=[sample_request_block],
|
|
320
|
+
scan_number=[1],
|
|
321
|
+
status="RUNNING",
|
|
322
|
+
active_request_block=None,
|
|
323
|
+
)
|
|
324
|
+
scan_queue_status = messages.ScanQueueStatus(info=[queue_info_entry], status="RUNNING")
|
|
325
|
+
client.queue.queue_storage.current_scan_queue = {"primary": scan_queue_status}
|
|
326
|
+
assert live_updates._element_in_queue() is False
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
@pytest.mark.timeout(20)
|
|
330
|
+
def test_element_in_queue_queue_id_in_info(bec_client_mock, sample_request_block):
|
|
331
|
+
client = bec_client_mock
|
|
332
|
+
live_updates = IPythonLiveUpdates(client)
|
|
333
|
+
|
|
334
|
+
# Test when queue_id is in info (should return True)
|
|
335
|
+
current_queue = mock.MagicMock()
|
|
336
|
+
current_queue.queue_id = "my_queue_id"
|
|
337
|
+
live_updates._current_queue = current_queue
|
|
338
|
+
|
|
339
|
+
queue_info_entry = messages.QueueInfoEntry(
|
|
340
|
+
queue_id="my_queue_id",
|
|
341
|
+
scan_id=["scan_id"],
|
|
342
|
+
is_scan=[True],
|
|
343
|
+
request_blocks=[sample_request_block],
|
|
344
|
+
scan_number=[1],
|
|
345
|
+
status="RUNNING",
|
|
346
|
+
active_request_block=None,
|
|
347
|
+
)
|
|
348
|
+
scan_queue_status = messages.ScanQueueStatus(info=[queue_info_entry], status="RUNNING")
|
|
349
|
+
client.queue.queue_storage.current_scan_queue = {"primary": scan_queue_status}
|
|
350
|
+
assert live_updates._element_in_queue() is True
|
|
@@ -107,11 +107,12 @@ class TestLiveTable:
|
|
|
107
107
|
)
|
|
108
108
|
def test_get_devices_from_scan_data(self, bec_client_mock, request_msg, scan_report_devices):
|
|
109
109
|
client = bec_client_mock
|
|
110
|
-
client.start()
|
|
111
110
|
data = messages.ScanMessage(
|
|
112
111
|
point_id=0, scan_id="", data={}, metadata={"scan_report_devices": scan_report_devices}
|
|
113
112
|
)
|
|
114
|
-
live_update = LiveUpdatesTable(
|
|
113
|
+
live_update = LiveUpdatesTable(
|
|
114
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
115
|
+
)
|
|
115
116
|
devices = live_update.get_devices_from_scan_data(data)
|
|
116
117
|
assert devices[0 : len(scan_report_devices)] == scan_report_devices
|
|
117
118
|
|
|
@@ -123,7 +124,9 @@ class TestLiveTable:
|
|
|
123
124
|
)
|
|
124
125
|
client.queue.request_storage.update_with_request(request_msg)
|
|
125
126
|
client.queue.request_storage.update_with_response(response_msg)
|
|
126
|
-
live_update = LiveUpdatesTable(
|
|
127
|
+
live_update = LiveUpdatesTable(
|
|
128
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
129
|
+
)
|
|
127
130
|
with mock.patch.object(client.queue.queue_storage, "find_queue_item_by_requestID"):
|
|
128
131
|
live_update.wait_for_request_acceptance()
|
|
129
132
|
|
|
@@ -138,7 +141,9 @@ class TestLiveTable:
|
|
|
138
141
|
client = bec_client_mock
|
|
139
142
|
client.start()
|
|
140
143
|
data = messages.ScanMessage(point_id=0, scan_id="", data={}, metadata={})
|
|
141
|
-
live_update = LiveUpdatesTable(
|
|
144
|
+
live_update = LiveUpdatesTable(
|
|
145
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
146
|
+
)
|
|
142
147
|
live_update.scan_item = scan_item
|
|
143
148
|
scan_item.num_points = 2
|
|
144
149
|
scan_item.live_data = {0: data}
|
|
@@ -163,7 +168,9 @@ class TestLiveTable:
|
|
|
163
168
|
client = bec_client_mock
|
|
164
169
|
client.start()
|
|
165
170
|
data = messages.ScanMessage(point_id=0, scan_id="", data={}, metadata={})
|
|
166
|
-
live_update = LiveUpdatesTable(
|
|
171
|
+
live_update = LiveUpdatesTable(
|
|
172
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
173
|
+
)
|
|
167
174
|
live_update.scan_item = scan_item
|
|
168
175
|
scan_item.num_points = 2
|
|
169
176
|
scan_item.live_data = {0: data}
|
|
@@ -193,7 +200,9 @@ class TestLiveTable:
|
|
|
193
200
|
)
|
|
194
201
|
client.queue.request_storage.update_with_request(request_msg)
|
|
195
202
|
client.queue.request_storage.update_with_response(response_msg)
|
|
196
|
-
live_update = LiveUpdatesTable(
|
|
203
|
+
live_update = LiveUpdatesTable(
|
|
204
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
205
|
+
)
|
|
197
206
|
live_update.point_data = messages.ScanMessage(
|
|
198
207
|
point_id=0,
|
|
199
208
|
scan_id="",
|
|
@@ -212,7 +221,9 @@ class TestLiveTable:
|
|
|
212
221
|
)
|
|
213
222
|
client.queue.request_storage.update_with_request(request_msg)
|
|
214
223
|
client.queue.request_storage.update_with_response(response_msg)
|
|
215
|
-
live_update = LiveUpdatesTable(
|
|
224
|
+
live_update = LiveUpdatesTable(
|
|
225
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
226
|
+
)
|
|
216
227
|
live_update.point_data = messages.ScanMessage(
|
|
217
228
|
point_id=0,
|
|
218
229
|
scan_id="",
|
|
@@ -231,7 +242,9 @@ class TestLiveTable:
|
|
|
231
242
|
)
|
|
232
243
|
client.queue.request_storage.update_with_request(request_msg)
|
|
233
244
|
client.queue.request_storage.update_with_response(response_msg)
|
|
234
|
-
live_update = LiveUpdatesTable(
|
|
245
|
+
live_update = LiveUpdatesTable(
|
|
246
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
247
|
+
)
|
|
235
248
|
client.device_manager.devices["samx"]._info["hints"] = {"fields": ["samx_hint"]}
|
|
236
249
|
client.device_manager.devices["samx"].precision = 3
|
|
237
250
|
live_update.point_data = messages.ScanMessage(
|
|
@@ -263,7 +276,9 @@ class TestLiveTable:
|
|
|
263
276
|
)
|
|
264
277
|
client.queue.request_storage.update_with_request(request_msg)
|
|
265
278
|
client.queue.request_storage.update_with_response(response_msg)
|
|
266
|
-
live_update = LiveUpdatesTable(
|
|
279
|
+
live_update = LiveUpdatesTable(
|
|
280
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
281
|
+
)
|
|
267
282
|
client.device_manager.devices["samx"]._info["hints"] = {"fields": ["samx_hint"]}
|
|
268
283
|
client.device_manager.devices["samx"].precision = prec
|
|
269
284
|
live_update.point_data = messages.ScanMessage(
|
|
@@ -312,7 +327,9 @@ class TestLiveTable:
|
|
|
312
327
|
)
|
|
313
328
|
client.queue.request_storage.update_with_request(request_msg)
|
|
314
329
|
client.queue.request_storage.update_with_response(response_msg)
|
|
315
|
-
live_update = LiveUpdatesTable(
|
|
330
|
+
live_update = LiveUpdatesTable(
|
|
331
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
332
|
+
)
|
|
316
333
|
live_update.point_data = messages.ScanMessage(
|
|
317
334
|
point_id=0,
|
|
318
335
|
scan_id="",
|
|
@@ -355,7 +372,9 @@ class TestLiveTable:
|
|
|
355
372
|
"find_queue_item_by_requestID",
|
|
356
373
|
return_value=mock_queue_item,
|
|
357
374
|
):
|
|
358
|
-
live_update = LiveUpdatesTable(
|
|
375
|
+
live_update = LiveUpdatesTable(
|
|
376
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
377
|
+
)
|
|
359
378
|
live_update.wait_for_request_acceptance()
|
|
360
379
|
result = StringIO()
|
|
361
380
|
with redirect_stdout(result):
|
|
@@ -376,7 +395,9 @@ class TestLiveTable:
|
|
|
376
395
|
)
|
|
377
396
|
client.queue.request_storage.update_with_request(request_msg)
|
|
378
397
|
client.queue.request_storage.update_with_response(response_msg)
|
|
379
|
-
live_update = LiveUpdatesTable(
|
|
398
|
+
live_update = LiveUpdatesTable(
|
|
399
|
+
client, {"scan_progress": {"points": 10, "show_table": True}}, request_msg
|
|
400
|
+
)
|
|
380
401
|
client.device_manager.devices["samx"]._info["hints"] = {"fields": ["samx_hint"]}
|
|
381
402
|
client.device_manager.devices["samx"].precision = prec
|
|
382
403
|
live_update.point_data = messages.ScanMessage(
|