Programmatically replacing an API for another module

Bruno Desthuilliers onurb at xiludom.gro
Tue Nov 21 06:09:51 EST 2006


Tom Plunket wrote:
> I've got a bunch of code that runs under a bunch of unit tests.  It'd
> be really handy if when testing I could supply replacement
> functionality to verify that the right things get called without those
> things actually getting called, since frequently those calls take a
> long time to execute and do things that, well, I don't really want to
> do.

Congratulation, you just rediscovered the MockObject.

(snip)



-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list