[TIP] Which mock object framework should I use?

Martin Aspeli optilude at gmx.net
Sun Nov 18 09:13:37 PST 2007

Gustavo Niemeyer wrote:
> Hello Martin,
>>> You can add Mocker <http://labix.org/mocker> to the list. Looks very
>>> well documented and thought out.
>> Ah yes, an omission from my side, I had actually looked at it. I agree
>> it looks good, but I'd appreciate any pointers to practical experience.
> You won't find many pointers for practical experience with Mocker yet,
> as I've released it publicly only a week ago or so.  Even then, I do
> believe it has a superset of the features of all the others, and a few
> more, in a well packed way.
> Please let me know if you have any questions or suggestions about it.

I'm having trouble getting 0.9 installed. :-/

I'm in a virtualenv, and I did

  $ easy_install mocker

This produced a .egg file (downloaded from launchpad) without any Python 
code in it, just the EGG-INFO. :-/

Then I downloaded the .tar.bz2 manually and ran

  $ python setup.py install

Same effect - 'mocker' is not importable and no .py files end up in 


  $ python setup.py develop

does work. I wonder if this is because your setup.py doesn't have a 
'packages' option in the call to setup(), but I'm not sure since I've 
never tried to distribute an egg that consists of just one module 
(mocker.py). Come to think of it, I've only ever made eggs with 
namespace packages. :)

Having an easy_install'able version would be a prerequisite for me to 
use this, as I need to be able to declare it a dependency of other 
packages. Hopefully, it's an easy fix though.


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