mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 19:21:50 +02:00
test: improve error message for widgets that are not properly cleaned up
This commit is contained in:
@ -145,7 +145,14 @@ def test_available_widgets(qtbot, connected_client_gui_obj):
|
|||||||
|
|
||||||
# Check that the number of top level widgets is still the same. As the cleanup is done by the
|
# Check that the number of top level widgets is still the same. As the cleanup is done by the
|
||||||
# qt event loop, we need to wait for the qtbot to finish the cleanup
|
# qt event loop, we need to wait for the qtbot to finish the cleanup
|
||||||
qtbot.waitUntil(lambda: len(gui._server_registry) == top_level_widgets_count)
|
try:
|
||||||
|
qtbot.waitUntil(lambda: len(gui._server_registry) == top_level_widgets_count)
|
||||||
|
except Exception as exc:
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Widget {object_name} was not removed properly. The number of top level widgets "
|
||||||
|
f"is {len(gui._server_registry)} instead of {top_level_widgets_count}. The following "
|
||||||
|
f"widgets are still registered: {list(gui._server_registry.keys())}."
|
||||||
|
) from exc
|
||||||
# Number of widgets with parent_id == None, should be 2
|
# Number of widgets with parent_id == None, should be 2
|
||||||
widgets = [
|
widgets = [
|
||||||
widget
|
widget
|
||||||
|
Reference in New Issue
Block a user