[TIP] Python mock library comparison

Michael Foord fuzzyman at voidspace.org.uk
Sat Mar 5 09:10:53 PST 2011

On 28/02/2011 01:21, Gary Bernhardt wrote:
> Over the last few days, there's been some back-and-forth as various
> mock libraries update their comparison documents. This seems like a
> precarious situation asking to go out of sync. I decided to try and
> consolidate the efforts.
> Here's what we have:
>    - A GitHub project based on Michael's latest comparison document
> (https://github.com/garybernhardt/python-mock-comparison)
>    - A publicly reachable copy of the docs for linking
> (http://garybernhardt.github.com/python-mock-comparison/)
>    - All examples executing as doctests (160 tests total!)
>    - python-mock and pmock removed (both are unmaintained)
>    - Dingus examples added

I corrected one of the mock examples. I have github / ssh problems so I 
created an issue with patch instead:


As well as correcting a mock example it removes the broken links from 
index.rst. I also had to add the current directory to sys.path in 
conf.py in order to be able to execute the doctests on my system.

All the best,

Michael Foord

> I also found several examples that were wrong—enough to justify the
> effort in itself. The mocker examples were also quite out of date. Now
> that the examples are doctests, life will be perfect forever!
> The notable bits live in a single comparison.rst file. Mock library
> maintainers are welcome to include that in their docs (taking on the
> burden of keeping their copy up to date) or to simply link to the
> version hosted on GitHub.
> Here's what we still need:
>    - Fixes for the two failing Mox examples that are confusing me.
> They're currently marked XXX and commented out.
>    - Probably some cleanup of existing examples; my brain is fried
> after the conversion to doctests.
>    - Fudge and MiniMock examples (Kumar? Ian?)
> Pull requests are welcome!
> https://github.com/garybernhardt/python-mock-comparison


May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html

More information about the testing-in-python mailing list