Are there database testing tools for python (like sqlunit)? I want to test the DAL that is built using sqlalchemy
+2
A:
Follow the design pattern that Django uses.
Create a disposable copy of the database. Use SQLite3 in-memory, for example.
Create the database using the SQLAlchemy table and index definitions. This should be a fairly trivial exercise.
Load the test data fixture into the database.
Run your unit test case in a database with a known, defined state.
Dispose of the database.
If you use SQLite3 in-memory, this procedure can be reasonably fast.
S.Lott
2009-11-12 01:44:58