@testing.requires.savepoints_w_release
def test_savepoint_release_fails_ctxmanager(self, local_connection):
    connection = local_connection
    connection.begin()
    savepoint = [None]

    def go():
        with connection.begin_nested() as sp:
            savepoint[0] = sp
            connection.dialect.do_release_savepoint(connection, sp._savepoint)
    exc_ = assert_raises_message(exc.DBAPIError, '.*SQL\\:.*RELEASE SAVEPOINT', go)
    savepoint = savepoint[0]
    assert (not savepoint.is_active)
    if util.py3k:
        assert isinstance(exc_.__cause__, testing.db.dialect.dbapi.Error)
@testing.requires.savepoints_w_release
def test_savepoint_release_fails_ctxmanager(self, local_connection):
    connection = local_connection
    connection.begin()
    savepoint = [None]

    def go():
        with connection.begin_nested() as sp:
            savepoint[0] = sp
            connection.dialect.do_release_savepoint(connection, sp._savepoint)
    exc_ = assert_raises_message(exc.DBAPIError, '.*SQL\\:.*RELEASE SAVEPOINT', go)
    savepoint = savepoint[0]
    assert (not savepoint.is_active)
    if util.py3k:
        assert isinstance(exc_.__cause__, testing.db.dialect.dbapi.Error)