summaryrefslogtreecommitdiff
path: root/test/dialect/test_sqlite.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-01-01 00:18:31 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-01-01 00:18:31 +0000
commitcf126b49e7c88a0eb58920e2e85b628651fbcfd2 (patch)
tree2786d618704ddcd30427cad9c7a2a92e453d7344 /test/dialect/test_sqlite.py
parent7210595a79cd33b3b0da48db2806856fe018f495 (diff)
parentae354ce347336ba7efc1222c161e0da80314b485 (diff)
downloadsqlalchemy-cf126b49e7c88a0eb58920e2e85b628651fbcfd2.tar.gz
Merge "Fix test failures under Windows"
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r--test/dialect/test_sqlite.py66
1 files changed, 35 insertions, 31 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index ec88277a6..da349c1f8 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -43,6 +43,7 @@ from sqlalchemy.testing import assert_raises
from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import AssertsCompiledSQL
from sqlalchemy.testing import AssertsExecutionResults
+from sqlalchemy.testing import combinations
from sqlalchemy.testing import engines
from sqlalchemy.testing import eq_
from sqlalchemy.testing import expect_warnings
@@ -722,40 +723,43 @@ class DialectTest(fixtures.TestBase, AssertsExecutionResults):
e = create_engine("sqlite+pysqlite:///foo.db")
assert e.pool.__class__ is pool.NullPool
- def test_connect_args(self):
+ @combinations(
+ (
+ "sqlite:///foo.db", # file path is absolute
+ ([os.path.abspath("foo.db")], {}),
+ ),
+ (
+ "sqlite:////abs/path/to/foo.db",
+ ([os.path.abspath("/abs/path/to/foo.db")], {}),
+ ),
+ ("sqlite://", ([":memory:"], {})),
+ (
+ "sqlite:///?check_same_thread=true",
+ ([":memory:"], {"check_same_thread": True}),
+ ),
+ (
+ "sqlite:///file:path/to/database?"
+ "check_same_thread=true&timeout=10&mode=ro&nolock=1&uri=true",
+ (
+ ["file:path/to/database?mode=ro&nolock=1"],
+ {"check_same_thread": True, "timeout": 10.0, "uri": True},
+ ),
+ ),
+ (
+ "sqlite:///file:path/to/database?" "mode=ro&uri=true",
+ (["file:path/to/database?mode=ro"], {"uri": True}),
+ ),
+ (
+ "sqlite:///file:path/to/database?uri=true",
+ (["file:path/to/database"], {"uri": True}),
+ ),
+ )
+ def test_connect_args(self, url, expected):
"""test create_connect_args scenarios including support for uri=True"""
d = pysqlite_dialect.dialect()
- for url, expected in [
- (
- "sqlite:///foo.db", # file path is absolute
- ([os.path.abspath("foo.db")], {}),
- ),
- ("sqlite:////abs/path/to/foo.db", (["/abs/path/to/foo.db"], {})),
- ("sqlite://", ([":memory:"], {})),
- (
- "sqlite:///?check_same_thread=true",
- ([":memory:"], {"check_same_thread": True}),
- ),
- (
- "sqlite:///file:path/to/database?"
- "check_same_thread=true&timeout=10&mode=ro&nolock=1&uri=true",
- (
- ["file:path/to/database?mode=ro&nolock=1"],
- {"check_same_thread": True, "timeout": 10.0, "uri": True},
- ),
- ),
- (
- "sqlite:///file:path/to/database?" "mode=ro&uri=true",
- (["file:path/to/database?mode=ro"], {"uri": True}),
- ),
- (
- "sqlite:///file:path/to/database?uri=true",
- (["file:path/to/database"], {"uri": True}),
- ),
- ]:
- url = make_url(url)
- eq_(d.create_connect_args(url), expected)
+ url = make_url(url)
+ eq_(d.create_connect_args(url), expected)
@testing.combinations(
("no_persisted", "ignore"),