def test_wait_combine(self): r = Retrying(wait=tenacity.wait_combine(tenacity.wait_random(0, 3), tenacity.wait_fixed(5))) # Test it a few time since it's random for i in six.moves.range(1000): w = r.wait(1, 5) self.assertLess(w, 8) self.assertGreaterEqual(w, 5)
url=url, gh_owner=gh_owner, error_message=error_message, attempts=retry_state.attempt_number, seconds_since_start=retry_state.seconds_since_start, idle_sinde_start=retry_state.idle_for, response=response, exc_info=exc_info, ) connectivity_issue_retry = tenacity.retry( reraise=True, retry=tenacity.retry_if_exception_type( (RequestError, HTTPServerSideError, HTTPTooManyRequests)), wait=tenacity.wait_combine(wait_retry_after_header, tenacity.wait_exponential(multiplier=0.2)), stop=tenacity.stop_after_attempt(5), before=before_log, after=after_log, ) def raise_for_status(resp): if httpx.codes.is_client_error(resp.status_code): error_type = "Client Error" default_exception = HTTPClientSideError elif httpx.codes.is_server_error(resp.status_code): error_type = "Server Error" default_exception = HTTPServerSideError else: return