(_request: httpx.Request)
| 798 | nb_retries = 0 |
| 799 | |
| 800 | def retry_handler(_request: httpx.Request) -> httpx.Response: |
| 801 | nonlocal nb_retries |
| 802 | if nb_retries < failures_before_success: |
| 803 | nb_retries += 1 |
| 804 | if failure_mode == "exception": |
| 805 | raise RuntimeError("oops") |
| 806 | return httpx.Response(500) |
| 807 | return httpx.Response(200) |
| 808 | |
| 809 | respx_mock.post("/v1/messages").mock(side_effect=retry_handler) |
| 810 |
nothing calls this directly
no outgoing calls
no test coverage detected