<div dir="ltr"><div>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 source[1].</div><div><br></div><div>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. <br></div><div>So before importing <span style="font-family:monospace,monospace">
<span class="gmail-pl-k">import</span> <span class="gmail-pl-en">QEMEL.Objects</span> <span class="gmail-pl-c1">1.0</span> <span class="gmail-pl-k">as</span> <span class="gmail-pl-en">QO</span></span> it needs to have
<span style="font-family:monospace,monospace"><span class="gmail-pl-k">import</span> <span class="gmail-pl-en">QEMEL<font face="arial,helvetica,sans-serif">.</font></span></span>

<br></div><div><br></div><div>
<a href="https://www.riverbankcomputing.com/pipermail/pyqt/2017-November/039726.html">https://www.riverbankcomputing.com/pipermail/pyqt/2017-November/039726.html</a>



<br></div><div><br></div><div>
0: <a href="https://web.archive.org/web/20170102212156/http://pyqt.sourceforge.net/Docs/PyQt5/qml.html#writing-python-plugins-for-qmlscene">https://web.archive.org/web/20170102212156/http://pyqt.sourceforge.net/Docs/PyQt5/qml.html#writing-python-plugins-for-qmlscene</a><br></div><div>1: <a href="https://web.archive.org/web/20171210150909/http://pyqt.sourceforge.net/Docs/PyQt5/installation.html#building-and-installing-from-source">https://web.archive.org/web/20171210150909/http://pyqt.sourceforge.net/Docs/PyQt5/installation.html#building-and-installing-from-source</a><br></div><div>2: 
 <a href="https://github.com/Siecje/qmlplugin/commit/6d591abf3784ee858acf2853ff05e6c9b2abce07">https://github.com/Siecje/qmlplugin/commit/6d591abf3784ee858acf2853ff05e6c9b2abce07</a>

<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 21, 2018 at 5:23 AM, Alexander Rössler <span dir="ltr"><<a href="mailto:alexander@roessler.systems" target="_blank">alexander@roessler.systems</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Has anyone been successful with testing QML code and PyQt components<br>
together?<br>
<br>
When I try to run a QML file that contains a TestCase I get an module<br>
"Qt.test.qtestroot" not installed error.<br>
<br>
In general, I would prefer being able to test the QML application from<br>
Python, any ideas how this could be done? Currently I use pytest +<br>
pytest-qt for the non-GUI stuff.<br>
<br>
-- <br>
Alexander Rössler<br>
HMI Expert at Rössler Systems<br>
Tel: +43 680 1348338<br>
Web: <a href="https://roessler.systems" rel="noreferrer" target="_blank">https://roessler.systems</a><br>
Blog: <a href="https://machinekoder.com" rel="noreferrer" target="_blank">https://machinekoder.com</a><br>
alexander@roessler.systems<br>
Lebnergasse 1/7/7<br>
1210 Wien - Austria<br>
ATU72251528<br>
______________________________<wbr>_________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a></blockquote></div><br></div>