def METHOD_NAME(self, errclass, errno, errmsg, backoff_sleep_mock):
    """The retriable exception is raised after several retries."""
    count = 0
    @retry_on_mysql_lock_fail()
    def keep_raising():
        nonlocal count
        count += 1
        self._raise_mysql_error(errclass, errno, errmsg)
    pytest.raises(StatementError, keep_raising)
    assert count == 3
    assert backoff_sleep_mock.call_count == 2