Files
AareDAQ/tests/unit/gui/test_gui_entry.py
duan_jandClaude Fable 5 aa6c226103
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Successful in 1m17s
CI / test (3.11) (pull_request) Successful in 1m44s
CI / test (3.12) (pull_request) Successful in 1m41s
CI / test (3.13) (pull_request) Successful in 2m1s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m57s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 2m0s
CI / test-with-coverage (pull_request) Successful in 2m26s
CI / coverage-analysis (pull_request) Successful in 3s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 18m13s
test: cover every changed line in the branch diff
Diff coverage vs main now 100 percent from the gui suite alone:
non-staff locked banners and both gated-tab popups, remote-close
bookkeeping in update_daq_status, smargon staged moves, camera More
link and Alt-wheel axis fallback, number box relimits, energy row
emit, and the gui.main() banner/graceful-exit path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 09:20:44 +02:00

24 lines
939 B
Python

"""gui.main() startup path: the splash banner is a PNG again (the SVG
rendered wrong on RHEL9 consoles), so the resource block must resolve it —
and a failed startup must exit through the graceful error path, not crash."""
from unittest.mock import MagicMock, patch
import pytest
def test_main_resolves_banner_and_exits_gracefully(qapp):
from aare.gui import gui
with (
# A second QApplication would abort; hand main() a stand-in instead.
patch.object(gui, "QApplication", return_value=MagicMock()),
# process() on the stand-in app exits the interpreter at C level
# ("argument list cannot be empty") — option defaults still apply.
patch.object(gui.QCommandLineParser, "process", lambda self, app: None),
patch.object(gui, "QMessageBox"),
patch.object(gui, "auth", side_effect=RuntimeError("no server")),
pytest.raises(SystemExit),
):
gui.main()