[ACCEPTED]-What is your favorite Python mocking library?-mocking

Accepted answer
Score: 43

I've only used one, but I've had good results 11 with Michael Foord's Mock: http://www.voidspace.org.uk/python/mock/.

Michael's introduction 10 says it better than I could:

There are already 9 several Python mocking libraries available, so 8 why another one?

Most mocking libraries follow 7 the 'record -> replay' pattern of mocking. I 6 prefer the 'action -> assertion' pattern, which 5 is more readable and intuitive particularly 4 when working with the Python unittest module.

...

It 3 also provides utility functions / objects 2 to assist with testing, particularly monkey 1 patching.

Score: 8

Mox, from Google

0

Score: 5

Mocker from Gustavo Niemeyer.

It's not perfect, but 1 it is very powerful and flexible.

Score: 4

Dingus, by Gary Bernhardt.

0

Score: 4

I'm the author for mocktest. I think it's 2 pretty fully featured and easy to use, but 1 I might be biased:

http://gfxmonk.net/dist/doc/mocktest/doc/

Score: 3

pyDoubles the test doubles framework for Python, by 2 iExpertos.com. It supports mocks, stubs, spies 1 and matchers, including Hamcrest matchers

Score: 0

I've used pMock in the past, and didn't mind 2 it, it had pretty decent docs too. However, Foord's 1 Mock as mentioned above is also nice.

More Related questions