OK, I have some more information on this problem which I'll append to the Trac ticket.
It seems that different SQLAlchemy engines are being used during the set up and running phases of my second test. I asked on the SQLAlchemy list, and the advice was that there should only ever be one engine (i.e. one call to create_engine). However, I assume that the multiple calls TG2 makes is symptomatic of wanting a completely blank slate for each test method. The problem is in running the second test method, when a new engine is created and used for creating the model tables, but the *first* test method's (now empty) engine is used while running the actual test. Basically, it seems that the original engine is persisted somewhere, and is resurrected when issuing normal (non-DDL) SQL in websetup.py. model.metadata.create_all uses the newly created engine because it is passed in explictly as the bind. Invoking DBSession.configure (bind=my_new_engine) does not seem to update the engine in use by the ORM. At this point, it would be really useful if someone more familiar with the guts of TG2 could take a look at this and give me some pointers... There seems to be two possible fixes: get SQLAlchemy to realise we've moved on to a new engine, or only use one engine throughout an entire TG2 test suite, as SQLAlchemy expects. I've created a github project here: http://github.com/goodgravy/tg2-broken which recreates the bug - it's a new TG2 application, with the three extra methods described above. James On Nov 6, 3:39 pm, James <[email protected]> wrote: > Thanks Robert! > > http://trac.turbogears.org/ticket/2404 > > On Nov 6, 3:22 pm, Robert Forkel <[email protected]> wrote: > > > > Does TG2 have a Trac for me to open a ticket? > > > yes:http://trac.turbogears.org/ > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

