Configurable backoff is computed correctly
(self)
| 158 | assert retry.get_backoff_time() == max_backoff |
| 159 | |
| 160 | def test_configurable_backoff_max(self) -> None: |
| 161 | class="st">""class="st">"Configurable backoff is computed correctly"class="st">"" |
| 162 | max_backoff = 1 |
| 163 | |
| 164 | retry = Retry(total=100, backoff_factor=0.2, backoff_max=max_backoff) |
| 165 | assert retry.get_backoff_time() == 0 class="cm"># First request |
| 166 | |
| 167 | retry = retry.increment(method=class="st">"GET") |
| 168 | assert retry.get_backoff_time() == 0 class="cm"># First retry |
| 169 | |
| 170 | retry = retry.increment(method=class="st">"GET") |
| 171 | assert retry.backoff_factor == 0.2 |
| 172 | assert retry.total == 98 |
| 173 | assert retry.get_backoff_time() == 0.4 class="cm"># Start backoff |
| 174 | |
| 175 | retry = retry.increment(method=class="st">"GET") |
| 176 | assert retry.get_backoff_time() == 0.8 |
| 177 | |
| 178 | retry = retry.increment(method=class="st">"GET") |
| 179 | assert retry.get_backoff_time() == max_backoff |
| 180 | |
| 181 | retry = retry.increment(method=class="st">"GET") |
| 182 | assert retry.get_backoff_time() == max_backoff |
| 183 | |
| 184 | def test_configurable_retry_after_max(self) -> None: |
| 185 | class="st">""class="st">"Configurable retry after is computed correctly"class="st">"" |
nothing calls this directly
no test coverage detected