From bb48d5e1ed81c3fdaa32218ba782867c84dcded8 Mon Sep 17 00:00:00 2001 From: Pierre Raybaut <1311787+PierreRaybaut@users.noreply.github.com> Date: Mon, 5 Oct 2026 16:25:08 +0200 Subject: [PATCH] test: fix live preview test closing its dialog on Qt 6 QApplication.quit() closes top-level windows with Qt 6; exit() only leaves the loop. Assisted-by: Claude Opus 5.5 --- .../features/common/processing_preview_unit_test.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/datalab/tests/features/common/processing_preview_unit_test.py b/datalab/tests/features/common/processing_preview_unit_test.py index 787861091..2c5b8287f 100644 --- a/datalab/tests/features/common/processing_preview_unit_test.py +++ b/datalab/tests/features/common/processing_preview_unit_test.py @@ -856,11 +856,16 @@ def test_live_image_to_signal_preview(tmp_path, monkeypatch): assert expected.x.size == 8 dialog = ProcessingPreviewDialog(param, line_profile, [source]) loop = QW.QApplication.instance() + + def stop_loop(*_args) -> None: + # Unlike quit(), exit() does not close top-level windows with Qt 6 + loop.exit() + timeout = QC.QTimer() timeout.setSingleShot(True) - timeout.timeout.connect(loop.quit) - dialog.preview.controller.SIG_RESULT.connect(loop.quit) - dialog.preview.controller.SIG_ERROR.connect(loop.quit) + timeout.timeout.connect(stop_loop) + dialog.preview.controller.SIG_RESULT.connect(stop_loop) + dialog.preview.controller.SIG_ERROR.connect(stop_loop) dialog.show() executor = None try: