[PyQt] Testing PyQt using code with unit-tests and Mock

Andreas Pakulat apaku at gmx.de
Thu Jul 28 07:57:16 BST 2011


On 27.07.11 22:19:43, Phil Thompson wrote:
> On Wed, 27 Jul 2011 21:31:22 +0200, Andreas Pakulat <apaku at gmx.de> wrote:
> > Hi,
> > 
> > I've got a bit of a problem to test my PyQt based code via unit-tests
> > involving mock objects (specifically minimock).
> > 
> > I'd like to find a way to emit a signal with a mock-object instead of
> > the real, but I can't seem to find a way to do that. The attached
> > example demonstrates the problem. Instead of a real Param object I want
> > to pass in a Mock object
> > 
> > Is there a way to do this?
> > 
> > PyQt 4.8.3, Qt 4.7.3 and sip 4.12.1
> > 
> > Andreas
> 
> If the question is "can you dynamically change a QMetaObject", then the
> answer is no.

I see. Guess I'll have to create a subclass for the test than which
re-defines the signal parameter...

Andreas



More information about the PyQt mailing list