summaryrefslogtreecommitdiff
path: root/test/ext/test_horizontal_shard.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-08-05 13:43:06 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-08-05 13:49:52 -0400
commitd45bd29918e217662ea2c0ee44608b0bbf0d4a06 (patch)
treedd2bd8e16e0d4dc934f75334767fe1a12ed44319 /test/ext/test_horizontal_shard.py
parent849b2ed003b36610c1c53c9c72dbccdcb52a0bbc (diff)
downloadsqlalchemy-d45bd29918e217662ea2c0ee44608b0bbf0d4a06.tar.gz
Remove threadlocal strategy docs, remaining contextual_connect
in dfb20f07d8, we merged the removal of the threadlocal strategy from the 1.4 branch. We forgot to take the docs out :). Also, there seems to be an uncovered _contextual_connect call in horizontal shard. Cover that and repair. Fixes: #4632 Closes: #4795 Change-Id: Id05cbbebe34a8f547c9c84369a929a2926c7d093
Diffstat (limited to 'test/ext/test_horizontal_shard.py')
-rw-r--r--test/ext/test_horizontal_shard.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/ext/test_horizontal_shard.py b/test/ext/test_horizontal_shard.py
index affd7112c..838590f5b 100644
--- a/test/ext/test_horizontal_shard.py
+++ b/test/ext/test_horizontal_shard.py
@@ -517,13 +517,14 @@ class RefreshDeferExpireTest(fixtures.DeclarativeMappedTest):
s.add(A(data="d1", deferred_data="d2"))
s.commit()
- def _session_fixture(self):
+ def _session_fixture(self, **kw):
return ShardedSession(
shards={"main": testing.db},
shard_chooser=lambda *args: "main",
id_chooser=lambda *args: ["fake", "main"],
query_chooser=lambda *args: ["fake", "main"],
+ **kw
)
def test_refresh(self):
@@ -548,6 +549,13 @@ class RefreshDeferExpireTest(fixtures.DeclarativeMappedTest):
session.expire(a1)
eq_(a1.data, "d1")
+ def test_autocommit_session(self):
+ A = self.classes.A
+ session = self._session_fixture(autocommit=True)
+ a1 = session.query(A).set_shard("main").first()
+
+ eq_(a1.data, "d1")
+
class LazyLoadIdentityKeyTest(fixtures.DeclarativeMappedTest):
def _init_dbs(self):