[TIP] [python] Re: Mock Testing Patterns

Gustavo Niemeyer gustavo at niemeyer.net
Mon Nov 19 11:01:35 PST 2007


> Well, failing at a specific assertion is usually exact enough for us. I
> still find the 'record -> replay' approach backwards and less intuitive.
> I guess it is a question of taste, but I don't think you're going to
> persuade me. :-)

I'm not even trying.. I'm checking if there's something there
which I should learn.  So far I've seen some limits which make
it impossible to adopt this approach with the things *I* want
to use in a mock tool.  Mocker was born out of pure dissatisfaction
with what exists, and I totally understand that satisfaction is
something personal.

> I've rolled my own Mock class that lets me do what I want, and as is the
> way with Python it turns out to be less than 50 LOC. I'll post it
> shortly. It currently doesn't do the patching for you - but at Resolver
> we do this with a decorator pattern that I think is quite nice - so I'll
> add this shortly.

Cool, thanks.

-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the testing-in-python mailing list