class BetterTestApp(webtest.TestApp):
    """A testapp that prints the body when status does not match."""

def _check_status(self, status, res):
    if status is not None and status != res.status_int:
        raise webtest.AppError('Bad response: %s (not %s)\n%s', res.status,
            status, res)
Finding the real error in a Webtest test failure