u want to simulate what sqlalchemy is doing?
i'd put some layer facading between the app and the sqlalchemy, then 
replace sqlalchemy with something else. that'll need a) test that 
assures the two facades behave equivalent, and b) the app tests 
should not rely on any partcular persistency-flavour.

in my bitemporal lib i have a set of tests that use a facade, and then 
i either plug behind the in-memory [plain lists] implementation, or 
the db-implementation. each implementation has its own tests as well 
assuring the basic ops work. still, getting all these combined to 
work was not very easy.


another unrelated way is to have presetup sqlite db files, on which to 
run the tests (instead of buiding db from scratch each time). this 
may or may not be faster, depends what is longer - the initial 
insertions or the actual tests.

just some ideas..
svil

On Sunday 18 January 2009 21:00:12 Adam Dziendziel wrote:
> Hello,
>
> I'm working on a larger project which is using SQLAlchemy. We
> started with writing automated tests using an in-memory SQLite
> database and inserting test data in setUp() then emptying tables in
> tearDown(). Even though the in-memory SQLite is pretty fast, the
> process of inserting test data (sometimes a hundred of records)
> takes significant amount some time. Eventually, a test which should
> take 30ms, takes 300ms.
>
> One solution is probably to create a DAO layer with find_by..()
> methods on top of the SQLAlchemy layer and then write a DAO mock
> which stores records in an array. Another one would be to create a
> fake session which stores records in an array. The latter would
> probably be better because we are not creating another unnecessary
> layer, but harder to implement, because of the complex query API.
>
> How do you cope with this situation?
>
> Best regards,
> Adam
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to