-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(client): assure error not called on done #3934
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test needs to be added where no on_error
is passed to see that on_done
is not called in that case
tests/unit/clients/test_helper.py
Outdated
|
||
|
||
@pytest.fixture | ||
def flow(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flow_with_exception_request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small required changes
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
Codecov Report
@@ Coverage Diff @@
## master #3934 +/- ##
==========================================
+ Coverage 88.86% 89.07% +0.20%
==========================================
Files 180 180
Lines 12627 12627
==========================================
+ Hits 11221 11247 +26
+ Misses 1406 1380 -26
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
jina/clients/helper.py
Outdated
@@ -79,7 +79,7 @@ def callback_exec( | |||
""" | |||
if on_error and response.status.code >= jina_pb2.StatusProto.ERROR: | |||
_safe_callback(on_error, continue_on_error, logger)(response) | |||
elif on_done: | |||
elif on_done and response.status.code < jina_pb2.StatusProto.ERROR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif on_done and response.status.code < jina_pb2.StatusProto.ERROR: | |
elif on_done and response.status.code == jina_pb2.StatusProto.SUCCESS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated!
tests/unit/clients/test_helper.py
Outdated
'', on_done=on_done_mock, on_error=on_error_mock, on_always=on_always_mock | ||
) | ||
on_always_mock.assert_called_once() | ||
on_done_mock.assert_not_called() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these asserts outside the context, otherwise if exception test may pass
No description provided.