<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 07/03/2012 09:43, Luca Beltrame wrote:
<blockquote cite="mid:1958848.gdlZPQILNq@giskard" type="cite">
<pre wrap="">In data mercoledì 7 marzo 2012 09:37:38, Mads Ipsen ha scritto:
</pre>
<blockquote type="cite">
<pre wrap="">the Python unittest moudle. I have attached a few examples. If you have
time to take a look and comment, it would be great.
</pre>
</blockquote>
<pre wrap="">
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.
</pre>
</blockquote>
Signals are emitted. You can emulate pressing a button using the
static utility methods from the QTest module; the slots that the
button signal is connected to will be called. In some cases, if the
called slots perform a lot of processing, I usually call
QtGui.qApp.processEvents() after triggering the event. However, I am
not an expert, so I don't know if this is the right approach/thing
to do.<br>
<br>
<blockquote cite="mid:1958848.gdlZPQILNq@giskard" type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">* Hook up a slot which gets called when the thread finishes
</pre>
</blockquote>
<pre wrap="">
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.
</pre>
<blockquote type="cite">
<pre wrap="">* Start the event loop by calling QtGui.qApp.exec_()
</pre>
</blockquote>
<pre wrap="">
I think I've tried this in the past and it didn't quite work for me.
</pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
+-----------------------------------------------------+
| Mads Ipsen |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv | |
| DK-2500 Valby | phone: +45-29716388 |
| Denmark | email: <a class="moz-txt-link-abbreviated" href="mailto:mads.ipsen@gmail.com">mads.ipsen@gmail.com</a> |
+----------------------+------------------------------+
</pre>
</body>
</html>