bec-widgets 0.93.2__py3-none-any.whl → 0.93.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.
- CHANGELOG.md +24 -28
- PKG-INFO +1 -1
- bec_widgets/qt_utils/settings_dialog.py +11 -0
- bec_widgets/widgets/color_button/color_button.py +7 -0
- bec_widgets/widgets/dock/dock.py +4 -1
- bec_widgets/widgets/dock/dock_area.py +15 -1
- bec_widgets/widgets/figure/figure.py +21 -16
- bec_widgets/widgets/figure/plots/image/image.py +14 -0
- bec_widgets/widgets/figure/plots/plot_base.py +8 -0
- bec_widgets/widgets/image/image_widget.py +2 -0
- bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py +9 -0
- bec_widgets/widgets/website/website.py +6 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/METADATA +1 -1
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/RECORD +42 -42
- pyproject.toml +1 -1
- tests/end-2-end/test_scan_control_e2e.py +0 -1
- tests/unit_tests/conftest.py +33 -2
- tests/unit_tests/test_bec_dock.py +0 -1
- tests/unit_tests/test_bec_figure.py +31 -24
- tests/unit_tests/test_bec_image.py +7 -3
- tests/unit_tests/test_bec_image_widget.py +0 -1
- tests/unit_tests/test_bec_motor_map.py +28 -14
- tests/unit_tests/test_bec_queue.py +0 -1
- tests/unit_tests/test_bec_status_box.py +0 -1
- tests/unit_tests/test_color_map_selector.py +0 -1
- tests/unit_tests/test_device_input_base.py +0 -1
- tests/unit_tests/test_device_input_widgets.py +0 -6
- tests/unit_tests/test_motor_map_widget.py +0 -2
- tests/unit_tests/test_plot_base.py +9 -4
- tests/unit_tests/test_ring_progress_bar.py +0 -1
- tests/unit_tests/test_scan_control.py +0 -1
- tests/unit_tests/test_setting_dialog.py +1 -2
- tests/unit_tests/test_stop_button.py +0 -1
- tests/unit_tests/test_text_box_widget.py +0 -1
- tests/unit_tests/test_toggle.py +0 -1
- tests/unit_tests/test_vscode_widget.py +2 -2
- tests/unit_tests/test_waveform1d.py +46 -23
- tests/unit_tests/test_waveform_widget.py +0 -1
- tests/unit_tests/test_website_widget.py +0 -2
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/WHEEL +0 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/licenses/LICENSE +0 -0
@@ -9,18 +9,11 @@ from bec_widgets.widgets.figure.plots.motor_map.motor_map import BECMotorMap
|
|
9
9
|
from bec_widgets.widgets.figure.plots.waveform.waveform import BECWaveform
|
10
10
|
|
11
11
|
from .client_mocks import mocked_client
|
12
|
+
from .conftest import create_widget
|
12
13
|
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
widget = BECFigure(client=mocked_client)
|
17
|
-
qtbot.addWidget(widget)
|
18
|
-
qtbot.waitExposed(widget)
|
19
|
-
yield widget
|
20
|
-
widget.close()
|
21
|
-
|
22
|
-
|
23
|
-
def test_bec_figure_init(bec_figure):
|
15
|
+
def test_bec_figure_init(qtbot, mocked_client):
|
16
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
24
17
|
assert bec_figure is not None
|
25
18
|
assert bec_figure.client is not None
|
26
19
|
assert isinstance(bec_figure, BECFigure)
|
@@ -34,7 +27,8 @@ def test_bec_figure_init_with_config(mocked_client):
|
|
34
27
|
assert widget.config.theme == "dark"
|
35
28
|
|
36
29
|
|
37
|
-
def test_bec_figure_add_remove_plot(
|
30
|
+
def test_bec_figure_add_remove_plot(qtbot, mocked_client):
|
31
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
38
32
|
initial_count = len(bec_figure._widgets)
|
39
33
|
|
40
34
|
# Adding 3 widgets - 2 WaveformBase and 1 PlotBase
|
@@ -64,7 +58,8 @@ def test_bec_figure_add_remove_plot(bec_figure):
|
|
64
58
|
assert bec_figure._widgets[w1.gui_id].config.widget_class == "BECWaveform"
|
65
59
|
|
66
60
|
|
67
|
-
def test_add_different_types_of_widgets(
|
61
|
+
def test_add_different_types_of_widgets(qtbot, mocked_client):
|
62
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
68
63
|
plt = bec_figure.plot(x_name="samx", y_name="bpm4i")
|
69
64
|
im = bec_figure.image("eiger")
|
70
65
|
motor_map = bec_figure.motor_map("samx", "samy")
|
@@ -74,7 +69,8 @@ def test_add_different_types_of_widgets(bec_figure):
|
|
74
69
|
assert motor_map.__class__ == BECMotorMap
|
75
70
|
|
76
71
|
|
77
|
-
def test_access_widgets_access_errors(
|
72
|
+
def test_access_widgets_access_errors(qtbot, mocked_client):
|
73
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
78
74
|
bec_figure.plot(row=0, col=0)
|
79
75
|
|
80
76
|
# access widget by non-existent coordinates
|
@@ -96,7 +92,8 @@ def test_access_widgets_access_errors(bec_figure):
|
|
96
92
|
)
|
97
93
|
|
98
94
|
|
99
|
-
def test_add_plot_to_occupied_position(
|
95
|
+
def test_add_plot_to_occupied_position(qtbot, mocked_client):
|
96
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
100
97
|
bec_figure.plot(row=0, col=0)
|
101
98
|
|
102
99
|
with pytest.raises(ValueError) as excinfo:
|
@@ -104,7 +101,8 @@ def test_add_plot_to_occupied_position(bec_figure):
|
|
104
101
|
assert "Position at row 0 and column 0 is already occupied." in str(excinfo.value)
|
105
102
|
|
106
103
|
|
107
|
-
def test_remove_plots(
|
104
|
+
def test_remove_plots(qtbot, mocked_client):
|
105
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
108
106
|
w1 = bec_figure.plot(row=0, col=0)
|
109
107
|
w2 = bec_figure.plot(row=0, col=1)
|
110
108
|
w3 = bec_figure.plot(row=1, col=0)
|
@@ -134,7 +132,8 @@ def test_remove_plots(bec_figure):
|
|
134
132
|
assert len(bec_figure._widgets) == 1
|
135
133
|
|
136
134
|
|
137
|
-
def test_remove_plots_by_coordinates_ints(
|
135
|
+
def test_remove_plots_by_coordinates_ints(qtbot, mocked_client):
|
136
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
138
137
|
w1 = bec_figure.plot(row=0, col=0)
|
139
138
|
w2 = bec_figure.plot(row=0, col=1)
|
140
139
|
|
@@ -145,7 +144,8 @@ def test_remove_plots_by_coordinates_ints(bec_figure):
|
|
145
144
|
assert len(bec_figure._widgets) == 1
|
146
145
|
|
147
146
|
|
148
|
-
def test_remove_plots_by_coordinates_tuple(
|
147
|
+
def test_remove_plots_by_coordinates_tuple(qtbot, mocked_client):
|
148
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
149
149
|
w1 = bec_figure.plot(row=0, col=0)
|
150
150
|
w2 = bec_figure.plot(row=0, col=1)
|
151
151
|
|
@@ -156,7 +156,8 @@ def test_remove_plots_by_coordinates_tuple(bec_figure):
|
|
156
156
|
assert len(bec_figure._widgets) == 1
|
157
157
|
|
158
158
|
|
159
|
-
def test_remove_plot_by_id_error(
|
159
|
+
def test_remove_plot_by_id_error(qtbot, mocked_client):
|
160
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
160
161
|
bec_figure.plot()
|
161
162
|
|
162
163
|
with pytest.raises(ValueError) as excinfo:
|
@@ -164,7 +165,8 @@ def test_remove_plot_by_id_error(bec_figure):
|
|
164
165
|
assert "Widget with ID 'non_existent_widget' does not exist." in str(excinfo.value)
|
165
166
|
|
166
167
|
|
167
|
-
def test_remove_plot_by_coordinates_error(
|
168
|
+
def test_remove_plot_by_coordinates_error(qtbot, mocked_client):
|
169
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
168
170
|
bec_figure.plot(row=0, col=0)
|
169
171
|
|
170
172
|
with pytest.raises(ValueError) as excinfo:
|
@@ -172,7 +174,8 @@ def test_remove_plot_by_coordinates_error(bec_figure):
|
|
172
174
|
assert "No widget at coordinates (0, 1)" in str(excinfo.value)
|
173
175
|
|
174
176
|
|
175
|
-
def test_remove_plot_by_providing_nothing(
|
177
|
+
def test_remove_plot_by_providing_nothing(qtbot, mocked_client):
|
178
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
176
179
|
bec_figure.plot(row=0, col=0)
|
177
180
|
|
178
181
|
with pytest.raises(ValueError) as excinfo:
|
@@ -192,7 +195,8 @@ def test_remove_plot_by_providing_nothing(bec_figure):
|
|
192
195
|
# assert bec_figure.backgroundBrush().color().name() == "#000000"
|
193
196
|
|
194
197
|
|
195
|
-
def test_change_layout(
|
198
|
+
def test_change_layout(qtbot, mocked_client):
|
199
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
196
200
|
w1 = bec_figure.plot(row=0, col=0)
|
197
201
|
w2 = bec_figure.plot(row=0, col=1)
|
198
202
|
w3 = bec_figure.plot(row=1, col=0)
|
@@ -215,7 +219,8 @@ def test_change_layout(bec_figure):
|
|
215
219
|
assert bec_figure[0, 3] == w4
|
216
220
|
|
217
221
|
|
218
|
-
def test_clear_all(
|
222
|
+
def test_clear_all(qtbot, mocked_client):
|
223
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
219
224
|
bec_figure.plot(row=0, col=0)
|
220
225
|
bec_figure.plot(row=0, col=1)
|
221
226
|
bec_figure.plot(row=1, col=0)
|
@@ -227,7 +232,8 @@ def test_clear_all(bec_figure):
|
|
227
232
|
assert np.shape(bec_figure.grid) == (0,)
|
228
233
|
|
229
234
|
|
230
|
-
def test_shortcuts(
|
235
|
+
def test_shortcuts(qtbot, mocked_client):
|
236
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
231
237
|
plt = bec_figure.plot(x_name="samx", y_name="bpm4i")
|
232
238
|
im = bec_figure.image("eiger")
|
233
239
|
motor_map = bec_figure.motor_map("samx", "samy")
|
@@ -240,7 +246,8 @@ def test_shortcuts(bec_figure):
|
|
240
246
|
assert motor_map.__class__ == BECMotorMap
|
241
247
|
|
242
248
|
|
243
|
-
def test_plot_access_factory(
|
249
|
+
def test_plot_access_factory(qtbot, mocked_client):
|
250
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
244
251
|
plt_00 = bec_figure.plot(x_name="samx", y_name="bpm4i")
|
245
252
|
plt_01 = bec_figure.plot(x_name="samx", y_name="bpm4i", row=0, col=1)
|
246
253
|
plt_10 = bec_figure.plot(new=True)
|
@@ -6,8 +6,10 @@ import pytest
|
|
6
6
|
from bec_lib import messages
|
7
7
|
from qtpy.QtGui import QFontInfo
|
8
8
|
|
9
|
+
from bec_widgets.widgets.figure import BECFigure
|
10
|
+
|
9
11
|
from .client_mocks import mocked_client
|
10
|
-
from .
|
12
|
+
from .conftest import create_widget
|
11
13
|
|
12
14
|
|
13
15
|
@pytest.fixture
|
@@ -15,7 +17,8 @@ def bec_image_show(bec_figure):
|
|
15
17
|
yield bec_figure.image("eiger")
|
16
18
|
|
17
19
|
|
18
|
-
def test_on_image_update(
|
20
|
+
def test_on_image_update(qtbot, mocked_client):
|
21
|
+
bec_image_show = create_widget(qtbot, BECFigure, client=mocked_client).image("eiger")
|
19
22
|
data = np.random.rand(100, 100)
|
20
23
|
msg = messages.DeviceMonitor2DMessage(device="eiger", data=data, metadata={"scan_id": "12345"})
|
21
24
|
bec_image_show.on_image_update(msg.content, msg.metadata)
|
@@ -23,7 +26,8 @@ def test_on_image_update(bec_image_show):
|
|
23
26
|
assert np.array_equal(img.get_data(), data)
|
24
27
|
|
25
28
|
|
26
|
-
def test_autorange_on_image_update(
|
29
|
+
def test_autorange_on_image_update(qtbot, mocked_client):
|
30
|
+
bec_image_show = create_widget(qtbot, BECFigure, client=mocked_client).image("eiger")
|
27
31
|
# Check if autorange mode "mean" works, should be default
|
28
32
|
data = np.random.rand(100, 100)
|
29
33
|
msg = messages.DeviceMonitor2DMessage(device="eiger", data=data, metadata={"scan_id": "12345"})
|
@@ -2,14 +2,16 @@ import numpy as np
|
|
2
2
|
import pytest
|
3
3
|
from bec_lib.messages import DeviceMessage
|
4
4
|
|
5
|
+
from bec_widgets.widgets.figure import BECFigure
|
5
6
|
from bec_widgets.widgets.figure.plots.motor_map.motor_map import BECMotorMap, MotorMapConfig
|
6
7
|
from bec_widgets.widgets.figure.plots.waveform.waveform_curve import SignalData
|
7
8
|
|
8
9
|
from .client_mocks import mocked_client
|
9
|
-
from .
|
10
|
+
from .conftest import create_widget
|
10
11
|
|
11
12
|
|
12
|
-
def test_motor_map_init(
|
13
|
+
def test_motor_map_init(qtbot, mocked_client):
|
14
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
13
15
|
default_config = MotorMapConfig(widget_class="BECMotorMap")
|
14
16
|
|
15
17
|
mm = bec_figure.motor_map(config=default_config.model_dump())
|
@@ -18,7 +20,8 @@ def test_motor_map_init(bec_figure):
|
|
18
20
|
assert mm.config == default_config
|
19
21
|
|
20
22
|
|
21
|
-
def test_motor_map_change_motors(
|
23
|
+
def test_motor_map_change_motors(qtbot, mocked_client):
|
24
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
22
25
|
mm = bec_figure.motor_map("samx", "samy")
|
23
26
|
|
24
27
|
assert mm.motor_x == "samx"
|
@@ -32,7 +35,8 @@ def test_motor_map_change_motors(bec_figure):
|
|
32
35
|
assert mm.config.signals.y == SignalData(name="samz", entry="samz", limits=[-8, 8])
|
33
36
|
|
34
37
|
|
35
|
-
def test_motor_map_get_limits(
|
38
|
+
def test_motor_map_get_limits(qtbot, mocked_client):
|
39
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
36
40
|
mm = bec_figure.motor_map("samx", "samy")
|
37
41
|
expected_limits = {"samx": [-10, 10], "samy": [-5, 5]}
|
38
42
|
|
@@ -41,7 +45,8 @@ def test_motor_map_get_limits(bec_figure):
|
|
41
45
|
assert actual_limit == expected_limit
|
42
46
|
|
43
47
|
|
44
|
-
def test_motor_map_get_init_position(
|
48
|
+
def test_motor_map_get_init_position(qtbot, mocked_client):
|
49
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
45
50
|
mm = bec_figure.motor_map("samx", "samy")
|
46
51
|
mm.set_precision(2)
|
47
52
|
|
@@ -57,7 +62,8 @@ def test_motor_map_get_init_position(bec_figure):
|
|
57
62
|
assert actual_position == expected_position
|
58
63
|
|
59
64
|
|
60
|
-
def test_motor_movement_updates_position_and_database(
|
65
|
+
def test_motor_movement_updates_position_and_database(qtbot, mocked_client):
|
66
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
61
67
|
mm = bec_figure.motor_map("samx", "samy")
|
62
68
|
motor_map_dev = mm.client.device_manager.devices
|
63
69
|
|
@@ -85,7 +91,8 @@ def test_motor_movement_updates_position_and_database(bec_figure):
|
|
85
91
|
assert mm.database_buffer["y"] == init_positions["samy"]
|
86
92
|
|
87
93
|
|
88
|
-
def test_scatter_plot_rendering(
|
94
|
+
def test_scatter_plot_rendering(qtbot, mocked_client):
|
95
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
89
96
|
mm = bec_figure.motor_map("samx", "samy")
|
90
97
|
motor_map_dev = mm.client.device_manager.devices
|
91
98
|
|
@@ -115,7 +122,8 @@ def test_scatter_plot_rendering(bec_figure):
|
|
115
122
|
), "Scatter plot Y data should retain last known position"
|
116
123
|
|
117
124
|
|
118
|
-
def test_plot_visualization_consistency(
|
125
|
+
def test_plot_visualization_consistency(qtbot, mocked_client):
|
126
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
119
127
|
mm = bec_figure.motor_map("samx", "samy")
|
120
128
|
mm.change_motors("samx", "samy")
|
121
129
|
# Simulate updating the plot with new data
|
@@ -133,7 +141,8 @@ def test_plot_visualization_consistency(bec_figure):
|
|
133
141
|
), "Plot not updated correctly with new data"
|
134
142
|
|
135
143
|
|
136
|
-
def test_change_background_value(
|
144
|
+
def test_change_background_value(qtbot, mocked_client):
|
145
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
137
146
|
mm = bec_figure.motor_map("samx", "samy")
|
138
147
|
|
139
148
|
assert mm.config.background_value == 25
|
@@ -146,7 +155,8 @@ def test_change_background_value(bec_figure, qtbot):
|
|
146
155
|
assert np.all(mm.plot_components["limit_map"].image == 50.0)
|
147
156
|
|
148
157
|
|
149
|
-
def test_motor_map_init_from_config(
|
158
|
+
def test_motor_map_init_from_config(qtbot, mocked_client):
|
159
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
150
160
|
config = {
|
151
161
|
"widget_class": "BECMotorMap",
|
152
162
|
"gui_id": "mm_id",
|
@@ -200,7 +210,8 @@ def test_motor_map_init_from_config(bec_figure):
|
|
200
210
|
assert mm._config_dict == config
|
201
211
|
|
202
212
|
|
203
|
-
def test_motor_map_set_scatter_size(
|
213
|
+
def test_motor_map_set_scatter_size(qtbot, mocked_client):
|
214
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
204
215
|
mm = bec_figure.motor_map("samx", "samy")
|
205
216
|
|
206
217
|
assert mm.config.scatter_size == 5
|
@@ -213,7 +224,8 @@ def test_motor_map_set_scatter_size(bec_figure, qtbot):
|
|
213
224
|
assert mm.plot_components["scatter"].opts["size"] == 10
|
214
225
|
|
215
226
|
|
216
|
-
def test_motor_map_change_precision(
|
227
|
+
def test_motor_map_change_precision(qtbot, mocked_client):
|
228
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
217
229
|
mm = bec_figure.motor_map("samx", "samy")
|
218
230
|
|
219
231
|
assert mm.config.precision == 2
|
@@ -221,7 +233,8 @@ def test_motor_map_change_precision(bec_figure):
|
|
221
233
|
assert mm.config.precision == 10
|
222
234
|
|
223
235
|
|
224
|
-
def test_motor_map_set_color(
|
236
|
+
def test_motor_map_set_color(qtbot, mocked_client):
|
237
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
225
238
|
mm = bec_figure.motor_map("samx", "samy")
|
226
239
|
|
227
240
|
assert mm.config.color == (255, 255, 255, 255)
|
@@ -231,7 +244,8 @@ def test_motor_map_set_color(bec_figure, qtbot):
|
|
231
244
|
assert mm.config.color == (0, 0, 0, 255)
|
232
245
|
|
233
246
|
|
234
|
-
def test_motor_map_get_data_max_points(
|
247
|
+
def test_motor_map_get_data_max_points(qtbot, mocked_client):
|
248
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
235
249
|
mm = bec_figure.motor_map("samx", "samy")
|
236
250
|
motor_map_dev = mm.client.device_manager.devices
|
237
251
|
|
@@ -12,7 +12,6 @@ def device_input_combobox(qtbot, mocked_client):
|
|
12
12
|
qtbot.addWidget(widget)
|
13
13
|
qtbot.waitExposed(widget)
|
14
14
|
yield widget
|
15
|
-
widget.close()
|
16
15
|
|
17
16
|
|
18
17
|
@pytest.fixture
|
@@ -28,7 +27,6 @@ def device_input_combobox_with_config(qtbot, mocked_client):
|
|
28
27
|
qtbot.addWidget(widget)
|
29
28
|
qtbot.waitExposed(widget)
|
30
29
|
yield widget
|
31
|
-
widget.close()
|
32
30
|
|
33
31
|
|
34
32
|
@pytest.fixture
|
@@ -43,7 +41,6 @@ def device_input_combobox_with_kwargs(qtbot, mocked_client):
|
|
43
41
|
qtbot.addWidget(widget)
|
44
42
|
qtbot.waitExposed(widget)
|
45
43
|
yield widget
|
46
|
-
widget.close()
|
47
44
|
|
48
45
|
|
49
46
|
def test_device_input_combobox_init(device_input_combobox):
|
@@ -101,7 +98,6 @@ def device_input_line_edit(qtbot, mocked_client):
|
|
101
98
|
qtbot.addWidget(widget)
|
102
99
|
qtbot.waitExposed(widget)
|
103
100
|
yield widget
|
104
|
-
widget.close()
|
105
101
|
|
106
102
|
|
107
103
|
@pytest.fixture
|
@@ -117,7 +113,6 @@ def device_input_line_edit_with_config(qtbot, mocked_client):
|
|
117
113
|
qtbot.addWidget(widget)
|
118
114
|
qtbot.waitExposed(widget)
|
119
115
|
yield widget
|
120
|
-
widget.close()
|
121
116
|
|
122
117
|
|
123
118
|
@pytest.fixture
|
@@ -132,7 +127,6 @@ def device_input_line_edit_with_kwargs(qtbot, mocked_client):
|
|
132
127
|
qtbot.addWidget(widget)
|
133
128
|
qtbot.waitExposed(widget)
|
134
129
|
yield widget
|
135
|
-
widget.close()
|
136
130
|
|
137
131
|
|
138
132
|
def test_device_input_line_edit_init(device_input_line_edit):
|
@@ -16,7 +16,6 @@ def motor_map_widget(qtbot, mocked_client):
|
|
16
16
|
qtbot.addWidget(widget)
|
17
17
|
qtbot.waitExposed(widget)
|
18
18
|
yield widget
|
19
|
-
widget.close()
|
20
19
|
|
21
20
|
|
22
21
|
@pytest.fixture
|
@@ -139,7 +138,6 @@ def motor_map_settings(qtbot):
|
|
139
138
|
qtbot.addWidget(widget)
|
140
139
|
qtbot.waitExposed(widget)
|
141
140
|
yield widget
|
142
|
-
widget.close()
|
143
141
|
|
144
142
|
|
145
143
|
def test_display_current_settings(motor_map_settings):
|
@@ -4,18 +4,22 @@ from unittest import mock
|
|
4
4
|
import pytest
|
5
5
|
from qtpy.QtGui import QFontInfo
|
6
6
|
|
7
|
+
from bec_widgets.widgets.figure import BECFigure
|
8
|
+
|
7
9
|
from .client_mocks import mocked_client
|
8
|
-
from .
|
10
|
+
from .conftest import create_widget
|
9
11
|
|
10
12
|
|
11
|
-
def test_init_plot_base(
|
13
|
+
def test_init_plot_base(qtbot, mocked_client):
|
14
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
12
15
|
plot_base = bec_figure.add_widget(widget_type="BECPlotBase", widget_id="test_plot")
|
13
16
|
assert plot_base is not None
|
14
17
|
assert plot_base.config.widget_class == "BECPlotBase"
|
15
18
|
assert plot_base.config.gui_id == "test_plot"
|
16
19
|
|
17
20
|
|
18
|
-
def test_plot_base_axes_by_separate_methods(
|
21
|
+
def test_plot_base_axes_by_separate_methods(qtbot, mocked_client):
|
22
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
19
23
|
plot_base = bec_figure.add_widget(widget_type="BECPlotBase", widget_id="test_plot")
|
20
24
|
|
21
25
|
plot_base.set_title("Test Title")
|
@@ -65,7 +69,8 @@ def test_plot_base_axes_by_separate_methods(bec_figure):
|
|
65
69
|
assert mock_set_title.call_args == call
|
66
70
|
|
67
71
|
|
68
|
-
def test_plot_base_axes_added_by_kwargs(
|
72
|
+
def test_plot_base_axes_added_by_kwargs(qtbot, mocked_client):
|
73
|
+
bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
|
69
74
|
plot_base = bec_figure.add_widget(widget_type="BECPlotBase", widget_id="test_plot")
|
70
75
|
|
71
76
|
plot_base.set(
|
@@ -16,7 +16,6 @@ def setting_widget(qtbot):
|
|
16
16
|
qtbot.addWidget(widget)
|
17
17
|
qtbot.waitExposed(widget)
|
18
18
|
yield widget
|
19
|
-
widget.close()
|
20
19
|
|
21
20
|
|
22
21
|
def test_setting_widget_initialization(setting_widget):
|
@@ -61,8 +60,8 @@ def settings_dialog(qtbot, setting_widget):
|
|
61
60
|
qtbot.addWidget(dialog)
|
62
61
|
qtbot.waitExposed(dialog)
|
63
62
|
yield dialog, parent_widget, setting_widget
|
64
|
-
dialog.close()
|
65
63
|
parent_widget.close()
|
64
|
+
parent_widget.deleteLater()
|
66
65
|
|
67
66
|
|
68
67
|
def test_settings_dialog_initialization(settings_dialog):
|
tests/unit_tests/test_toggle.py
CHANGED
@@ -14,9 +14,9 @@ from .client_mocks import mocked_client
|
|
14
14
|
def vscode_widget(qtbot, mocked_client):
|
15
15
|
with mock.patch("bec_widgets.widgets.vscode.vscode.subprocess.Popen") as mock_popen:
|
16
16
|
widget = VSCodeEditor(client=mocked_client)
|
17
|
-
|
17
|
+
qtbot.addWidget(widget)
|
18
|
+
qtbot.waitExposed(widget)
|
18
19
|
yield widget
|
19
|
-
# widget.close()
|
20
20
|
|
21
21
|
|
22
22
|
def test_vscode_widget(qtbot, vscode_widget):
|