test(rpc): cover lazy widget registry discovery

This commit is contained in:
2026-04-15 10:48:17 +02:00
parent 152aadfffd
commit 02a5763a0f
2 changed files with 49 additions and 17 deletions
+13 -1
View File
@@ -1,4 +1,6 @@
from bec_widgets.utils.plugin_utils import get_custom_classes
import sys
from bec_widgets.utils.plugin_utils import get_custom_class_references, get_custom_classes
def test_client_generator_classes():
@@ -10,3 +12,13 @@ def test_client_generator_classes():
assert "Waveform" in connector_cls_names
assert "MotorMap" in plugins
assert "NonExisting" not in plugins
def test_get_custom_class_references_avoids_importing_widget_modules():
target_module = "bec_widgets.widgets.plots.image.image"
sys.modules.pop(target_module, None)
references = get_custom_class_references("bec_widgets", use_cache=False)
assert "Image" in [reference.name for reference in references]
assert target_module not in sys.modules