Thanks Mike. I made some progress ( I think! ). I now have the test class setup method successfully creating a new scoped session on each pass, and the objects that were created originally in a turbogears session context are being saved into that session and flushed to the db. I think this is the right approach, fresh session for each fresh fixture.
Now however, I'm getting the following on the second test: InvalidRequestError: Instance 'reg...@0x2db6950' is already persistent and looking at the session.identity_map, it's empty. If I replace session.save(obj) with session.save_or_update(obj) the exception does not get thrown. The new object *is* in the identity map of the new session at the end of the test, but no SQL to insert the object into the actual DB gets generated. ( I'm on sa 0.4.2, yes it's a bit of a legacy case... ) I have the fixture drop and recreate the tables, so I'm hoping there is some way of copying these objects form their prototype declaration class into a new session and flush to the newly created tables on each pass. Any tips much appreciated again, Iain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---