[TIP] Python mock library comparison

Gary Bernhardt gary.bernhardt at gmail.com
Sun Mar 6 11:53:27 PST 2011

On Sat, Mar 5, 2011 at 11:41 PM, Kumar McMillan
<kumar.mcmillan at gmail.com> wrote:
> Thanks Gary.  It's pretty cool to see everything side by side.  Here
> is the Fudge section:
> https://github.com/kumar303/python-mock-comparison/compare/master
> (pull request sent)
> fwiw, I'm not a huge fan of abstract code examples using some_object,
> some_method, some_value, etc.  I much prefer examples that represent
> realistic situations, even if they are slightly contrived -- it's so
> much easier on my brain!  This was a major requirement for me when I
> wrote fudge's own documentation --
> http://farmdev.com/projects/fudge/using-fudge.html -- and I encourage
> all developers to think up realistic situations when writing code
> samples.
> That said, I like mocking the open function as a context manager,
> that's something one might do in real life so it will make sense to a
> developer who is considering a mock library.

Thanks; merged and pushed live.

I agree about realistic examples. These are still just the original
mox examples, but with bug fixes and tweaks to run as doctests. I'd
like them converted to more realistic examples.

It's also hard to read quickly because there are so many libraries and
examples. I'd like it to break down into (1) a super simple comparison
at the top, showing the flavor of all libraries on one screen, and (2)
a comparison section where you can choose which libraries to compare,
using JS to hide and show them.

Of course, it still needs minimock examples, and two of the mox
examples are broken because I find mox confusing.

Does anyone understand mox, know minimock, want to make the examples
more realistic, or want to make the dynamic stuff happen? Pull
requests welcome! ;) I made GitHub issues for all of these things.


More information about the testing-in-python mailing list