Python and database unittests

Marco Bizzarri marco.bizzarri at gmail.com
Wed Aug 27 03:48:02 EDT 2008


On Wed, Aug 27, 2008 at 4:55 AM, alex23 <wuwei23 at gmail.com> wrote:
> Daniel <daniel.watr... at gmail.com> wrote:
>> Does anyone know about a module that acts as a database stub for
>> python unittests?
>
> It's not database-specific, but the Mock module should help you here:
>
> http://python-mock.sourceforge.net/
>
> There's even an example on that page for mocking a database.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

I strongly disagree on using mocks for a database; checking sequences
of SQL statement is fragile, painful, and leads you to frustration
when the actual SQL and the generated SQL do not match.

Regards
Marco

-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/



More information about the Python-list mailing list