diff options
| author | Tony Locke <tlocke@tlocke.org.uk> | 2014-05-14 14:36:08 +0100 |
|---|---|---|
| committer | Tony Locke <tlocke@tlocke.org.uk> | 2014-05-22 20:13:10 +0100 |
| commit | 66e0a7771f66b352e6712cf2d71936c6f8238617 (patch) | |
| tree | b9dd5d79d34bfae3017c5180ee6624180fa80095 /test/dialect/postgresql/test_dialect.py | |
| parent | 32bae567fe487ca78d23d775792e6dbd7657ba53 (diff) | |
| download | sqlalchemy-66e0a7771f66b352e6712cf2d71936c6f8238617.tar.gz | |
Autocommit isolation level for postgresql+pg8000
As with postgresql+psycopg2,
execution_options(isolation_level='AUTOCOMMIT') now works for the
postgresql+pg8000 dialect.
Also enabled the autocommit test in test_dialect.py for pg8000.
Diffstat (limited to 'test/dialect/postgresql/test_dialect.py')
| -rw-r--r-- | test/dialect/postgresql/test_dialect.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index e0d3e6f9e..e2b04c9c6 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -111,15 +111,21 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): c = e.connect() eq_(c.connection.connection.encoding, test_encoding) - @testing.only_on('postgresql+psycopg2', 'psycopg2-specific feature') + @testing.only_on( + ['postgresql+psycopg2', 'postgresql+pg8000'], + 'psycopg2 / pg8000 - specific feature') @engines.close_open_connections def test_autocommit_isolation_level(self): - extensions = __import__('psycopg2.extensions').extensions - - c = testing.db.connect() - c = c.execution_options(isolation_level='AUTOCOMMIT') - eq_(c.connection.connection.isolation_level, - extensions.ISOLATION_LEVEL_AUTOCOMMIT) + c = testing.db.connect().execution_options( + isolation_level='AUTOCOMMIT') + # If we're really in autocommit mode then we'll get an error saying + # that the prepared transaction doesn't exist. Otherwise, we'd + # get an error saying that the command can't be run within a + # transaction. + assert_raises_message( + exc.ProgrammingError, + 'prepared transaction with identifier "gilberte" does not exist', + c.execute, "commit prepared 'gilberte'") @testing.fails_on('+zxjdbc', "Can't infer the SQL type to use for an instance " |
