I have a couple tables I would like to truncate when each integration test is done running. This works fine, in some cases, as long as there's exception thrown from any of the tests. In other cases, only the first test works and the others hang on the TRUNCATE call.
I know it must have something to do with connections to the database or something like that, but I'm not sure how. I am closing the Session after each test and even tried to disable the connection pooling. My teardown calls rollback() on the session just in case there was an Exception or failed assertion. The code I'm using to truncate is pretty basic and uses a newly configured engine that has pooling disabled.: engine = create_engine( 'postgresql://%s:%s@%s/%s' % (Settings.DB_USER, Settings.DB_PASSWD, Settings.DB_HOST, dataBaseName), echo=True, poolclass=NullPool ) with contextlib.closing(engine.connect()) as con: trans = con.begin() con.execute('truncate table "Schema"."Table" cascade') trans.commit() engine = None Is there something else I need to do to ensure all DB connections are closed? I'm using PG 9.0, SA 0.6.6 and PY 2.66. -- 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.