Skip to content

Commit 262d558

Browse files
committed
Wait for scan completion in max cameras test
Improve stability of test_max_cameras_prevented by waiting for the scan to finish before injecting results. Removed the backend='fake' remark from the docstring and added qtbot.waitUntil(lambda: not d._is_scan_running(), timeout=1000) and d._on_scan_finished() around the simulated scan result to ensure the dialog is in a stable state before interacting with UI widgets.
1 parent 48faa41 commit 262d558

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/gui/camera_config/test_cam_dialog_e2e.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def _warn(parent, title, text, *args, **kwargs):
329329
@pytest.mark.gui
330330
def test_max_cameras_prevented(qtbot, monkeypatch, patch_detect_cameras):
331331
"""
332-
Dialog enforces MAX_CAMERAS enabled cameras. Use backend='fake' for stability.
332+
Dialog enforces MAX_CAMERAS enabled cameras.
333333
"""
334334
calls = {"n": 0}
335335

@@ -357,7 +357,9 @@ def _warn(parent, title, text, *args, **kwargs):
357357

358358
initial_count = d.active_cameras_list.count()
359359

360+
qtbot.waitUntil(lambda: not d._is_scan_running(), timeout=1000)
360361
d._on_scan_result([DetectedCamera(index=4, label="Extra")])
362+
d._on_scan_finished()
361363
d.available_cameras_list.setCurrentRow(0)
362364

363365
qtbot.mouseClick(d.add_camera_btn, Qt.LeftButton)

0 commit comments

Comments
 (0)