[TIP] Mocking frameworks
Gregory P. Smith
greg at krypto.org
Sun Apr 4 09:24:24 PDT 2010
On Sat, Apr 3, 2010 at 4:08 PM, Kev <kevin.p.dwyer at gmail.com> wrote:
> Hello List,
> I've been googling python mocking frameworks recently to find one that
> provides similar functionality, in terms of expectations, to Jmock2.
> Does anyone know which python mocking frameworks provide such
> functionality, and where the staste of the art is at the moment?
Two to look at:
http://code.google.com/p/pymox/ - this is what we use all over the
place at Google. It is supposedly similar to Java's EasyMock.
This one is interesting because it doesn't have the somewhat odd out
of order catch-all "now check that everything I predeclared would
happen has happened" method as pymox does. It records things and you
write normal unittest assertions based on inspecting the mocks after
I'm really not sure what the state of the art is at the moment because
once a large project starts using a mock library of any sort, it tends
to become committed to using it and doesn't change as that'd make
tests less consistent.
More information about the testing-in-python