summaryrefslogtreecommitdiff
path: root/test/dialect/test_sqlite.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-08-29 22:17:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-08-30 11:35:10 -0400
commit916bd20b6d1e7c153d334c31cf0882f502e3815e (patch)
tree3bc26b4780cebe27b122b6b1a3901c6ea4bc402d /test/dialect/test_sqlite.py
parent9131a5208f28ea3c2991c2b05873a495c1a9c851 (diff)
downloadsqlalchemy-916bd20b6d1e7c153d334c31cf0882f502e3815e.tar.gz
ensure pysqlite dialect enumerates correct isolation levels
Fixed bug where the error message for SQLite invalid isolation level on the pysqlite driver would fail to indicate that "AUTOCOMMIT" is one of the valid isolation levels. Change-Id: Icbceab9a28af6a560859761fa92320b5473269a9 References: #6959
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r--test/dialect/test_sqlite.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index b5ce291eb..ed0f11907 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -54,6 +54,7 @@ from sqlalchemy.testing import expect_warnings
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import is_
from sqlalchemy.testing import mock
+from sqlalchemy.testing.assertions import expect_raises_message
from sqlalchemy.types import Boolean
from sqlalchemy.types import Date
from sqlalchemy.types import DateTime
@@ -596,6 +597,22 @@ class DialectTest(
)
)
+ @testing.requires.insert_order_dicts
+ @testing.only_on("sqlite+pysqlite")
+ def test_isolation_level_message(self):
+ # needs to test that all three words are present and we also
+ # dont want to default all isolation level messages to use
+ # sorted(), so rely on python 3.7 for ordering of keywords
+ # in the message
+ with expect_raises_message(
+ exc.ArgumentError,
+ "Invalid value 'invalid' for "
+ "isolation_level. Valid isolation levels for "
+ "sqlite are READ UNCOMMITTED, SERIALIZABLE, AUTOCOMMIT",
+ ):
+ with testing.db.connect() as conn:
+ conn.execution_options(isolation_level="invalid")
+
@testing.only_on("sqlite+pysqlcipher")
def test_pysqlcipher_connects(self):
"""test #6586"""