#!/usr/bin/env python3 """Run the actual NetworkController with QML fake devices; never instantiate Networking.""" import os from pathlib import Path import shutil import subprocess import tempfile root = Path(__file__).resolve().parents[1] with tempfile.TemporaryDirectory(prefix='adaptive-network-controller-') as tmp: runtime = Path(tmp, 'runtime') runtime.mkdir(mode=0o700) config = Path(tmp, 'config') config.mkdir() shutil.copyfile(root / 'tests/fixtures/network.qml', config / 'shell.qml') shutil.copyfile(root / 'services/NetworkController.qml', config / 'NetworkController.qml') components = config / 'components' components.mkdir() for name in ['NetworkCard.qml', 'ActionButton.qml']: shutil.copyfile(root / 'components' / name, components / name) services = config / 'services' services.mkdir() (services / 'qmldir').write_text('singleton Theme 1.0 Theme.qml\n') (services / 'Theme.qml').write_text('pragma Singleton\nimport QtQuick\nQtObject { property color foreground: "white"; property color outline: "gray"; property color background: "black"; property color surface: "#222222"; property color primary: "#d0bcff" }\n') env = dict(os.environ, QT_QPA_PLATFORM='offscreen', XDG_RUNTIME_DIR=str(runtime), XDG_STATE_HOME=tmp, XDG_CACHE_HOME=tmp) result = subprocess.run(['quickshell', '-p', str(config), '--no-color'], env=env, capture_output=True, text=True, timeout=20) logs = result.stdout + result.stderr print(logs) assert result.returncode == 0 and 'NETWORK_TEST_PASS: 9 scenarios' in logs, logs for marker in ['NETWORK_TEST_FAIL', 'Failed to load configuration', 'ReferenceError', 'TypeError', 'Binding loop']: assert marker not in logs, marker