From f9cc01408d9f725dfe6bb3ba01ab2ce0d3fe9dd2 Mon Sep 17 00:00:00 2001 From: David Perl Date: Mon, 15 Sep 2025 14:10:25 +0200 Subject: [PATCH] fix: tests --- bec_widgets/cli/client.py | 62 +++++++++++++++++++ .../device_resource_backend.py | 2 +- tests/unit_tests/test_device_browser.py | 2 +- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/bec_widgets/cli/client.py b/bec_widgets/cli/client.py index 3281dddb..26a64cb2 100644 --- a/bec_widgets/cli/client.py +++ b/bec_widgets/cli/client.py @@ -236,6 +236,26 @@ class AutoUpdates(RPCBase): """ +class AvailableDeviceResources(RPCBase): + @rpc_call + def remove(self): + """ + Cleanup the BECConnector + """ + + @rpc_call + def attach(self): + """ + None + """ + + @rpc_call + def detach(self): + """ + Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget. + """ + + class BECDock(RPCBase): @property @rpc_call @@ -1100,6 +1120,48 @@ class Curve(RPCBase): """ +class DMConfigView(RPCBase): + @rpc_call + def remove(self): + """ + Cleanup the BECConnector + """ + + @rpc_call + def attach(self): + """ + None + """ + + @rpc_call + def detach(self): + """ + Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget. + """ + + +class DMOphydTest(RPCBase): + """Widget to test device configurations using ophyd devices.""" + + @rpc_call + def remove(self): + """ + Cleanup the BECConnector + """ + + @rpc_call + def attach(self): + """ + None + """ + + @rpc_call + def detach(self): + """ + Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget. + """ + + class DapComboBox(RPCBase): """The DAPComboBox widget is an extension to the QComboBox with all avaialble DAP model from BEC.""" diff --git a/bec_widgets/widgets/control/device_manager/components/available_device_resources/device_resource_backend.py b/bec_widgets/widgets/control/device_manager/components/available_device_resources/device_resource_backend.py index 7da504e3..145d2110 100644 --- a/bec_widgets/widgets/control/device_manager/components/available_device_resources/device_resource_backend.py +++ b/bec_widgets/widgets/control/device_manager/components/available_device_resources/device_resource_backend.py @@ -103,7 +103,7 @@ class _ConfigFileBackend(DeviceResourceBackend): def _get_configs_from_plugin_files(self, dir: Path): files = glob("*.yaml", root_dir=dir, recursive=True) - return reduce(operator.or_, map(_devices_from_file, (str(dir / f) for f in files))) + return reduce(operator.or_, map(_devices_from_file, (str(dir / f) for f in files)), set()) def _get_tag_groups(self) -> dict[str, set[HashableDevice]]: return { diff --git a/tests/unit_tests/test_device_browser.py b/tests/unit_tests/test_device_browser.py index 2ccb2585..7c36594e 100644 --- a/tests/unit_tests/test_device_browser.py +++ b/tests/unit_tests/test_device_browser.py @@ -100,7 +100,7 @@ def test_device_item_expansion(device_browser, qtbot): form = tab_widget.widget(0).layout().itemAt(0).widget() assert widget.expanded assert (name_field := form.widget_dict.get("name")) is not None - qtbot.waitUntil(lambda: name_field.getValue() == "samx", timeout=500) + qtbot.waitUntil(lambda: name_field.getValue() == "aptrx", timeout=500) qtbot.mouseClick(widget._expansion_button, Qt.MouseButton.LeftButton) assert not widget.expanded