"""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()