[PyQt] Unit testing PyQt applications

Mads Ipsen madsipsen at gmail.com
Wed Mar 7 09:16:22 GMT 2012


Have modified the Bar example, since the thread was never started. Sorry 
for posting an incomplete example.

Anyway, now in this case, running the unittest gives:

FQThread: Destroyed while thread is still running
Segmentation fault


On 07/03/2012 09:43, Luca Beltrame wrote:
> In data mercoledì 7 marzo 2012 09:37:38, Mads Ipsen ha scritto:
>
>> the Python unittest moudle. I have attached a few examples. If you have
>> time to take a look and comment, it would be great.
> I have a question on FooTest: is having a QApplication instance enough in
> unittest to ensure emission of signals? Otherwise your problem does not only
> apply to using threads, but to any use of unittest with signals and slots.
>
>> * Hook up a slot which gets called when the thread finishes
> As I said above, are signals emitted in the FooTest case? I ask because I've
> been meaning to add unittest to my applications but I was not sure how to
> handle the case of slots and signals.
>
>> * Start the event loop by calling QtGui.qApp.exec_()
> I think I've tried this in the past and it didn't quite work for me.
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
+-----------------------------------------------------+
| Mads Ipsen                                          |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv |                              |
| DK-2500 Valby        | phone:          +45-29716388 |
| Denmark              | email:  mads.ipsen at gmail.com |
+----------------------+------------------------------+


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120307/ffe2846c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bar.py
Type: text/x-python
Size: 580 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120307/ffe2846c/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BarTest.py
Type: text/x-python
Size: 735 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120307/ffe2846c/attachment-0001.py>


More information about the PyQt mailing list