[TIP] Python mock library comparison

Gary Bernhardt gary.bernhardt at gmail.com
Sun Feb 27 17:21:26 PST 2011


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 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

-- 
Gary
http://blog.extracheese.org



More information about the testing-in-python mailing list