def test_commit_fails_flat(self, local_connection):
    connection = local_connection
    t1 = connection.begin()
    with mock.patch.object(connection, '_commit_impl', mock.Mock(side_effect=exc.DBAPIError('failure', None, None, None))):
        assert_raises_message(exc.DBAPIError, 'failure', t1.commit)
    assert (not t1.is_active)
    t1.rollback()
def test_commit_fails_flat(self, local_connection):
    connection = local_connection
    t1 = connection.begin()
    with mock.patch.object(connection, '_commit_impl', mock.Mock(side_effect=exc.DBAPIError('failure', None, None, None))):
        assert_raises_message(exc.DBAPIError, 'failure', t1.commit)
    assert (not t1.is_active)
    t1.rollback()