apart of all runtime issues u've hit - session etc - on declaration level u'll may do these: - destroy all your refs to the mappers/tables etc - sqlalchemy.orm.clearmappes() - yourmetadata.drop_all() - yourengine.dispose() - destroy refs to yourmetadata/yourengine (dbcook.usage.sa_manager.py/destroy()) if your classes are made-on-the-fly inside some function, then every time they are _different_ classes. Make sure u do not hold them somewhere - or they will keep all the stuff asociated with them (mappers and even session). The reason is the replaced __init__ method is stored as class.__init (in orm.attributes.register_class) and is not cleared in clearmappers.
for easy check, u can run your test 100 times and watch the memory used; if it grows then _something_ of all those above is not cleared. ciao svilen On Thursday 24 January 2008 00:00:52 Kumar McMillan wrote: > Hello, I have not been able to figure this out from the docs. > > I would like to setup and teardown test data using mapped classes. > The problem is that those same mapped classes need to be used by > the application under test and in case there is an error, the > teardown still needs to run so that subsequent tests can setup more > data. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---