summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/suite/test_dialect.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-12-08 22:07:48 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-12-09 11:20:26 -0500
commit7528c2465b3e56ed094f155bff2a3ab8c89cc84f (patch)
treef6272e47d90df26e663b0f753b01e1d5f0157e5a /lib/sqlalchemy/testing/suite/test_dialect.py
parentc736eef8b35841af89ec19469aa496585efd3865 (diff)
downloadsqlalchemy-7528c2465b3e56ed094f155bff2a3ab8c89cc84f.tar.gz
Implement Oracle SERIALIZABLE + real read of isolation level
There's some significant awkwardness in that we can't read the level unless a transaction is started, which normally does not occur unless DML is emitted. The implementation uses the local_transaction_id function to start a transaction. It is not known what the performance impact of this might have, however by default the function is called only once on first connect and later only if the get_isolation_level() method is used. Fixes: #5755 Change-Id: I0453a6b0a49420826707f660931002ba2338fbf0
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_dialect.py')
-rw-r--r--lib/sqlalchemy/testing/suite/test_dialect.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_dialect.py b/lib/sqlalchemy/testing/suite/test_dialect.py
index 7f697b915..f860a321b 100644
--- a/lib/sqlalchemy/testing/suite/test_dialect.py
+++ b/lib/sqlalchemy/testing/suite/test_dialect.py
@@ -122,6 +122,28 @@ class IsolationLevelTest(fixtures.TestBase):
eq_(conn.get_isolation_level(), existing)
+ def test_all_levels(self):
+ levels = requirements.get_isolation_levels(config)
+
+ all_levels = levels["supported"]
+
+ for level in set(all_levels).difference(["AUTOCOMMIT"]):
+ with config.db.connect() as conn:
+ conn.execution_options(isolation_level=level)
+
+ eq_(conn.get_isolation_level(), level)
+
+ trans = conn.begin()
+ trans.rollback()
+
+ eq_(conn.get_isolation_level(), level)
+
+ with config.db.connect() as conn:
+ eq_(
+ conn.get_isolation_level(),
+ levels["default"],
+ )
+
class AutocommitTest(fixtures.TablesTest):