something like:
- clean _all_ your refs to SA stuff like tables, mappers etc
- sqlalchemy.orm.clear_mappers()
- metadata.drop_all()
- dbengine.dispose()
plus eventualy
del x._instance_key
del x._state
for all instances that are still around, and u want them resued in
another db/mapping/...
plus each db-dialect has its own way of removing/recreating a db (e.g.
delete the file for sqlite, or dropdb xxx fos postgres etc).
see dbcook.usage.sa_manager (methods destroy() and
detach_instances() ) and dbcook.usage.sa_engine_defs, various
recreate()s
ciao
On Friday 18 April 2008 21:34:03 iain duncan wrote:
> > How can I realize this concept of a completely new and isolated
> > DB environment for each single test case that's being run?
>
> Not sure if this is a useful answer or not, but I just made
> starting sql files for each of my test suites. It's an extra step
> but then you have a convenient file to put starting data in.
>
> def setup(self):
> os.sys("mysql -ufoo -pbar -Ddb_name < test_db_1.sql")
> etc etc
>
> Works ok and is actually pretty quick.
> Iain
>
>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---