MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_detach

Method test_detach

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

Source from the content-addressed store, hash-verified

1928 assert c1.dbapi_connection.id != c_id
1929
1930 def test_detach(self):
1931 dbapi, p = self._queuepool_dbapi_fixture(pool_size=1, max_overflow=0)
1932 c1 = p.connect()
1933 c1.detach()
1934 c2 = p.connect() # noqa
1935 eq_(dbapi.connect.mock_calls, [call("foo.db"), call("foo.db")])
1936
1937 c1_con = c1.dbapi_connection
1938 assert c1_con is not None
1939 eq_(c1_con.close.call_count, 0)
1940 c1.close()
1941 eq_(c1_con.close.call_count, 1)
1942
1943 def test_detach_via_invalidate(self):
1944 dbapi, p = self._queuepool_dbapi_fixture(pool_size=1, max_overflow=0)

Callers

nothing calls this directly

Calls 6

eq_Function · 0.90
callFunction · 0.85
connectMethod · 0.45
detachMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected