MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_reconnect

Method test_reconnect

test/engine/test_pool.py:1912–1928  ·  test/engine/test_pool.py::QueuePoolTest.test_reconnect

tests reconnect operations at the pool level. SA's engine/dialect includes another layer of reconnect support for 'database was lost' errors.

(self)

Source from the content-addressed store, hash-verified

1910 assert p2._max_overflow == 0
1911
1912 def test_reconnect(self):
1913 class="st">"""tests reconnect operations at the pool level. SA&class="cm">#x27;s
1914 engine/dialect includes another layer of reconnect support for
1915 &class="cm">#x27;database was lost' errors.class="st">"""
1916
1917 dbapi, p = self._queuepool_dbapi_fixture(pool_size=1, max_overflow=0)
1918 c1 = p.connect()
1919 c_id = c1.dbapi_connection.id
1920 c1.close()
1921 c1 = None
1922 c1 = p.connect()
1923 assert c1.dbapi_connection.id == c_id
1924 dbapi.raise_error = True
1925 c1.invalidate()
1926 c1 = None
1927 c1 = p.connect()
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)

Callers

nothing calls this directly

Calls 4

connectMethod · 0.45
closeMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected