On 2008-08-26 23:35, Daniel wrote:
> Hello,
>
> I'm writing an application that interacts with a database. As I think
> about how to write the unittests, I want them to be able to run
> without actually having to access a live database. The pattern that
> best describes this is here:
>
> http:/
On Wed, Aug 27, 2008 at 10:26 AM, Simon Brunning
<[EMAIL PROTECTED]> wrote:
> 2008/8/27 Marco Bizzarri <[EMAIL PROTECTED]>:
>> 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 g
2008/8/27 Marco Bizzarri <[EMAIL PROTECTED]>:
> 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.
Clearly you need integration tests as well as unit te
2008/8/27 alex23 <[EMAIL PROTECTED]>:
> Daniel <[EMAIL PROTECTED]> wrote:
> 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.
There's a number of mocking modules for Python
On Tue, Aug 26, 2008 at 11:35 PM, Daniel <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm writing an application that interacts with a database. As I think
> about how to write the unittests, I want them to be able to run
> without actually having to access a live database. The pattern that
> best des
On Wed, Aug 27, 2008 at 4:55 AM, alex23 <[EMAIL PROTECTED]> wrote:
> Daniel <[EMAIL PROTECTED]> 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.sourceforg
On Wed, Aug 27, 2008 at 4:55 AM, alex23 <[EMAIL PROTECTED]> wrote:
> Daniel <[EMAIL PROTECTED]> 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.sourceforg
Daniel <[EMAIL PROTECTED]> 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:
Hey gordy,
Thanks for the reply. I am actually using sqlite in part of my
application and I don't feel the need to stub that. Even though I
don't use the in memory option, it is still zero configuration so I
build up my database in each test then delete it.
However, the way I interact with the
Daniel I don't know if it would work for your situation or not, but if
you are using Python 2.5, you could use the now built-in sqlite3
module. If you didn't even want to create a temporary database file
you could use the special memory-only syntax like this:
>>> import sqlite3
>>> conn =sqlite3.
Hello,
I'm writing an application that interacts with a database. As I think
about how to write the unittests, I want them to be able to run
without actually having to access a live database. The pattern that
best describes this is here:
http://martinfowler.com/eaaCatalog/serviceStub.html
I ha
11 matches
Mail list logo