"""Shared test setup: repo-root imports, the offscreen Qt platform, and hermetic QSettings (tests must not read or write the user's real viewer settings).""" import os import sys import tempfile from pathlib import Path os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from PyQt6.QtCore import QSettings # noqa: E402 QSettings.setPath(QSettings.Format.IniFormat, QSettings.Scope.UserScope, tempfile.mkdtemp(prefix="sras_qsettings_"))