Re: [PyQt] Unit testing PyQt applications

2012-03-14 Thread Mads Ipsen
Sorry for a late reply - but thanks for a very useful answer. Got one more question though. How would you technically moc QFileDialog.exec_ to avoid that the unit test is halted by the Dialog popping up in its own event loop. Anyway, this is how I do it: class Proxy: def __init__(self):

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Andreas Pakulat
On 07.03.12 15:42:34, Mads Ipsen wrote: > OK, I agree, the snippets I provided were not nice, and I apologize > for that. > > But suppose that the constructor in your class starts a thread that > generates say an icon for a QStandardItem. Then you want to make > sure that the thread has finished b

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Mads Ipsen
OK, I agree, the snippets I provided were not nice, and I apologize for that. But suppose that the constructor in your class starts a thread that generates say an icon for a QStandardItem. Then you want to make sure that the thread has finished before you test that the icon has been created.

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Andreas Pakulat
On 07.03.12 09:37:38, Mads Ipsen wrote: > Hi, > > I have a general question about how to unit test PyQt applications > using the Python unittest moudle. I have attached a few examples. If > you have time to take a look and comment, it would be great. > > The first module, Foo.py, defines a simple

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Mads Ipsen
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

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Mads Ipsen
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

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Mads Ipsen
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

Re: [PyQt] Unit testing PyQt applications

2012-03-07 Thread Luca Beltrame
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

[PyQt] Unit testing PyQt applications

2012-03-07 Thread Mads Ipsen
Hi, I have a general question about how to unit test PyQt applications using the Python unittest moudle. I have attached a few examples. If you have time to take a look and comment, it would be great. The first module, Foo.py, defines a simple widget called 'Widget' which is tested in FooTes