[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] How to test PyQt/QML applications?
From:       Cody Scott <cody () perspexis ! com>
Date:       2018-06-21 13:10:50
Message-ID: CAN04N8YAGso4Yam4tjH1z7pPKat_zO5CNixn6CJ7_tMfRq8Gyw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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].

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
QEMEL.

https://www.riverbankcomputing.com/pipermail/pyqt/2017-November/039726.html

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



On Thu, Jun 21, 2018 at 5:23 AM, Alexander R=C3=B6ssler <
alexander@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=C3=B6ssler
> HMI Expert at R=C3=B6ssler Systems
> Tel: +43 680 1348338
> Web: https://roessler.systems
> Blog: https://machinekoder.com
> alexander@roessler.systems
> Lebnergasse 1/7/7
> 1210 Wien - Austria
> ATU72251528
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[Attachment #5 (text/html)]

<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/Doc \
s/PyQt5/qml.html#writing-python-plugins-for-qmlscene">https://web.archive.org/web/2017 \
0102212156/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/P \
yQt5/installation.html#building-and-installing-from-source">https://web.archive.org/we \
b/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/6d591abf3784ee858acf2853ff05e6c9 \
b2abce07">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">&lt;<a href="mailto:alexander@roessler.systems" \
target="_blank">alexander@roessler.systems</a>&gt;</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>
&quot;Qt.test.qtestroot&quot; 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>



[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic