I'm using PyQt to integrate QtQuick into my Python app. I'm trying to figure out the best way to test my QtQuick Qml pages within a Python unittest framework. I'd like to pass a list of Qml files to some test function that makes sure no errors/exceptions exist for any of these files. Currently I'm trying to load a page into QQmlComponent and check for errors, but I haven't been able to get this working:
def test_qml(self):
app = QApplication(sys.argv)
engine = QQmlApplicationEngine()
rel = "/gui/QT/Page1.qml"
c = QQmlComponent(engine, QUrl.fromLocalFile(SRC_PATH + os.path.normpath(rel)))
print(c.errors())
Moreover from what I've read I think to get show errors with QQmlComponent I should catch a signal onStatusChange and then check so this seems like the wrong approach for me. What is the best way to go about trying to test qml pages in Python?