jscheffl commented on code in PR #45121:
URL: https://github.com/apache/airflow/pull/45121#discussion_r1895063603


##########
task_sdk/tests/api/test_client.py:
##########
@@ -82,6 +83,122 @@ def handle_request(request: httpx.Request) -> 
httpx.Response:
         assert err.value.args == ("Not found",)
         assert err.value.detail is None
 
+    @mock.patch("time.sleep", return_value=None)
+    def test_retry_handling_unrecoverable_error(self, mock_sleep):
+        responses: list[httpx.Response] = [
+            *[httpx.Response(500, text="Internal Server Error")] * 11,
+            httpx.Response(200, json={"detail": "Recovered from error - but 
will fail before"}),
+            httpx.Response(400, json={"detail": "Should not get here"}),
+        ]
+
+        def mock_handle_request(request: httpx.Request) -> httpx.Response:
+            return responses.pop(0)
+
+        client = Client(
+            base_url=None,
+            dry_run=True,
+            token="",
+            mounts={"'http://": httpx.MockTransport(mock_handle_request)},
+        )
+

Review Comment:
   Good point. Thanks for the proposal. Consolidated now... but w/o fixture as 
this does not provide a benefit over a "normal" utility like it was there 
before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to