MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_rec_close_reopen

Method test_rec_close_reopen

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

Source from the content-addressed store, hash-verified

227 is_(c1, r1.driver_connection)
228
229 def test_rec_close_reopen(self):
230 # test that _ConnectionRecord.close() allows
231 # the record to be reusable
232 dbapi = MockDBAPI()
233 p1 = pool.Pool(creator=lambda: dbapi.connect("foo.db"))
234
235 r1 = pool._ConnectionRecord(p1)
236
237 c1 = r1.dbapi_connection
238 c2 = r1.get_connection()
239 is_(c1, c2)
240
241 r1.close()
242
243 assert not r1.dbapi_connection
244 eq_(c1.mock_calls, [call.close()])
245
246 c2 = r1.get_connection()
247
248 is_not(c1, c2)
249 is_(c2, r1.dbapi_connection)
250
251 eq_(c2.mock_calls, [])
252
253 @testing.combinations(
254 (

Callers

nothing calls this directly

Calls 7

is_Function · 0.90
eq_Function · 0.90
is_notFunction · 0.90
get_connectionMethod · 0.80
MockDBAPIFunction · 0.70
connectMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected