Hello! Sorry for late answer - I was out of town. (It's strange nobody else
answered the question.)

On Sat, Nov 01, 2008 at 11:25:07PM +0000, Matthew Wilson wrote:
> I've got a lot of complex logic in some of my SQLObject methods, and I'd
> like to verify that they work in unit tests, and I don't want to have
> any kind of database connection, not even a SQLite in-memory database.
[skip]
> The test will run much faster if I can fake the connection to a
> database.
> 
> Is this possible?  Any advice on mocking or stubbing a database
> connection is welcome.

   There is no read-made fake connection in SQLObject, and it'd be a bit
hard to write one, but writing one is the only option if you don't want to
use even SQLite.
   You have to implement a connection class - look at SQLiteConnection for
an example (sqlobject/sqlite/sqliteconnection.py). Oh, even better - look
at MySQLConnection and PostgresConnection - they don't have as many
internal helper methods. You don't need to implement metainformation
manipulation and retrieval methods - tableExists, add/delColumn,
columnsFromSchema, guessClass - but other methods are must.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to