[TIP] mock objects

Mike Beachy mbeachy at gmail.com
Fri Apr 13 13:58:06 PDT 2007

Hi all -

Does anyone have any insight to offer on the various mock object libs?
I just slapped together a test using pymock and found that it took
about twice as many lines of code as compared to a test that used a
simple fake object.

The only "advantage" I see is that the pymock test guarantees that no
additional calls are made to the mocked object. But, this seems to be
a rather tight binding to the underlying protocol.

Do I just not get it? Is this a case of a Java pattern not
successfully translating to python? Does the infrastructure pay off
after you get larger numbers of tests in place?

The only mock lib I've seen that seems worthwhile so far is Ian
Bicking's minimock.


More information about the testing-in-python mailing list