MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_raw_connection_context

Method test_raw_connection_context

test/engine/test_pool.py:168–185  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

166 assert "foo2" in c.info
167
168 def test_raw_connection_context(self):
169 p = self._queuepool_fixture(pool_size=1, max_overflow=0)
170 e = create_engine("sqlite://", pool=p, _initialize=False)
171
172 eq_(p.checkedout(), 0)
173 conn = e.raw_connection()
174 eq_(p.checkedout(), 1)
175 with conn as wc:
176 eq_(p.checkedout(), 1)
177 is_(conn, wc)
178
179 eq_(p.checkedout(), 0)
180
181 with expect_raises_message(ValueError, "an error"):
182 with e.raw_connection() as wc:
183 eq_(p.checkedout(), 1)
184 raise ValueError("an error")
185 eq_(p.checkedout(), 0)
186
187 def test_rec_info(self):
188 p = self._queuepool_fixture(pool_size=1, max_overflow=0)

Callers

nothing calls this directly

Calls 7

create_engineFunction · 0.90
eq_Function · 0.90
is_Function · 0.90
expect_raises_messageFunction · 0.90
_queuepool_fixtureMethod · 0.80
checkedoutMethod · 0.80
raw_connectionMethod · 0.45

Tested by

no test coverage detected