[TIP] Which mock object framework should I use?

Martin Aspeli optilude at gmx.net
Sat Nov 17 11:06:30 PST 2007


Hi all,

I'd like to use a mock objects library to mock out services. So far, 
I've seen:

  - pymock
  - python-mock
  - pMock
  - minimock
  - Mocky

Some of these (the last two) are doctest-only propositions as far as I 
can see, in that they basically print stuff that you then verify. I can 
see how that's useful, but I'd also like something more explicit, where 
I can make declarations about which methods I expect to be called, in 
which order, with particular arguments and returning particular values.

 From a brief glance, pymock looks nice in that it's based on EasyMock, 
which I've used in Java. I could imagine using a combination of this and 
minimock in doctests.

Has anyone done a more thorough evaluation and come up with any 
recommendations?

Thanks,
Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book




More information about the testing-in-python mailing list