From a793b8e05069db9ca97b6adbb36fa1110561d30e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 10 Aug 2010 10:24:02 -0400 Subject: - Fixed the psycopg2 dialect to use its set_isolation_level() method instead of relying upon the base "SET SESSION ISOLATION" command, as psycopg2 resets the isolation level on each new transaction otherwise. --- test/dialect/test_postgresql.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/dialect/test_postgresql.py') diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 86b3617ab..a605594d4 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -1325,9 +1325,23 @@ class MiscTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): isolation_level='SERIALIZABLE') eq_(eng.execute('show transaction isolation level').scalar(), 'serializable') + + # check that it stays + conn = eng.connect() + eq_(conn.execute('show transaction isolation level').scalar(), + 'serializable') + conn.close() + + conn = eng.connect() + eq_(conn.execute('show transaction isolation level').scalar(), + 'serializable') + conn.close() + eng = create_engine(testing.db.url, isolation_level='FOO') if testing.db.driver == 'zxjdbc': exception_cls = eng.dialect.dbapi.Error + elif testing.db.driver == 'psycopg2': + exception_cls = exc.InvalidRequestError else: exception_cls = eng.dialect.dbapi.ProgrammingError assert_raises(exception_cls, eng.execute, -- cgit v1.2.1