[PyQt] How to test PyQt/QML applications?

Cody Scott cody at perspexis.com
Thu Jun 21 14:10:50 BST 2018

You can use qmltestrunner, but you have to register your Python types so
that qmlscene and qmltestrunner can use them[0]. To register them you need
to use the pyqt5qmlplugin and to get that you need to build PyQt5 from

Here is an example of how to structure your code as a plugin[2]. I will
take a look but I think the problem with the second commit in that repo is
that you have to import the first level first.
So before importing import QEMEL.Objects 1.0 as QO it needs to have import



On Thu, Jun 21, 2018 at 5:23 AM, Alexander Rössler <
alexander at roessler.systems> wrote:

> Has anyone been successful with testing QML code and PyQt components
> together?
> When I try to run a QML file that contains a TestCase I get an module
> "Qt.test.qtestroot" not installed error.
> In general, I would prefer being able to test the QML application from
> Python, any ideas how this could be done? Currently I use pytest +
> pytest-qt for the non-GUI stuff.
> --
> Alexander Rössler
> HMI Expert at Rössler Systems
> Tel: +43 680 1348338
> Web: https://roessler.systems
> Blog: https://machinekoder.com
> alexander at roessler.systems
> Lebnergasse 1/7/7
> 1210 Wien - Austria
> ATU72251528
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180621/7083d43a/attachment.html>

More information about the PyQt mailing list