[TIP] Pycon Talks
Pete
pfein at pobox.com
Mon Mar 5 07:13:06 PST 2007
On Sunday March 4 2007 6:09 pm, Grig Gheorghiu wrote:
> --- Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> My view is that you should mock only when your code depends on external
> interfaces that generate random results (Web servers, XML-RPC servers,
> etc.). Generally speaking, at the I/O boundaries of your application,
> or when you deal with libraries/3rd party code over which you have no
> control.
>
> It's also useful to mock the database layer, for several reasons:
>
> 1) speed
> 2) consistency in getting back the results you need
> 3) simulating exceptions
>
> You can also achieve 1) and 2) with small test databases (in-memory or
> not). But it's very hard to achieve 3) without mocking.
*THIS* is what I needed to hear at Pycon.
Most of the testing talks assumed too much.
More information about the testing-in-python
mailing list