summaryrefslogtreecommitdiff
path: root/test/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-07-08 10:42:20 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-07-08 10:42:20 -0400
commit3238d953b42f67761dc3019bd27f2960ae2e525f (patch)
treef90962b324be393a1b9130b4de01040fea4a38d0 /test/engine
parentdd453e19a79785e91463cd2b37d12a1d0f36c03a (diff)
downloadsqlalchemy-3238d953b42f67761dc3019bd27f2960ae2e525f.tar.gz
Ensure .engine is part of Connectable interface, implement as descriptor
Fixed bug where using reflection function such as :meth:`.MetaData.reflect` with an :class:`.Engine` object that had execution options applied to it would fail, as the resulting :class:`.OptionEngine` proxy object failed to include a ``.engine`` attribute used within the reflection routines. Fixes: #4754 Change-Id: I6c342af5c6db6fe362b9d25f3f26d6859f62f87a
Diffstat (limited to 'test/engine')
-rw-r--r--test/engine/test_execute.py4
-rw-r--r--test/engine/test_reflection.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py
index 20c8ae659..335c3a487 100644
--- a/test/engine/test_execute.py
+++ b/test/engine/test_execute.py
@@ -635,10 +635,14 @@ class ExecuteTest(fixtures.TestBase):
options={"execution_options": {"base": "x1"}}
)
+ is_(eng.engine, eng)
+
eng1 = eng.execution_options(foo="b1")
+ is_(eng1.engine, eng1)
eng2 = eng.execution_options(foo="b2")
eng1a = eng1.execution_options(bar="a1")
eng2a = eng2.execution_options(foo="b3", bar="a2")
+ is_(eng2a.engine, eng2a)
eq_(eng._execution_options, {"base": "x1"})
eq_(eng1._execution_options, {"base": "x1", "foo": "b1"})
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py
index 3dc3a4461..1cabf8963 100644
--- a/test/engine/test_reflection.py
+++ b/test/engine/test_reflection.py
@@ -1198,6 +1198,11 @@ class ReflectionTest(fixtures.TestBase, ComparesTables):
def test_reflect_uses_bind_engine_reflect(self):
self._test_reflect_uses_bind(lambda e: MetaData().reflect(e))
+ def test_reflect_uses_bind_option_engine_reflect(self):
+ self._test_reflect_uses_bind(
+ lambda e: MetaData().reflect(e.execution_options(foo="bar"))
+ )
+
@testing.provide_metadata
def test_reflect_all(self):
existing = testing.db.table_names()