-
Notifications
You must be signed in to change notification settings - Fork 843
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 #1377 Add unit tests for #1367 changes #1378
Conversation
@@ -127,6 +127,10 @@ def convert_params(values: dict) -> dict: | |||
) | |||
except aiohttp.ContentTypeError: | |||
logger.debug(f"No response data returned from the following API call: {api_url}.") | |||
retry_response = RetryHttpResponse( |
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 potential bug
@@ -199,5 +199,5 @@ def validate(self): | |||
""" | |||
if self.status_code == 200 and self.data and (isinstance(self.data, bytes) or self.data.get("ok", False)): | |||
return self | |||
msg = f"The request to the Slack API failed. (url: {self.api_url})" | |||
msg = f"The request to the Slack API failed. (url: {self.api_url}, status: {self.status_code})" |
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.
for better debuggability
@@ -88,3 +84,30 @@ async def test_fatal_error(self): | |||
client.retry_handlers.append(FatalErrorRetryHandler()) | |||
# The auto-retry should work here | |||
await client.auth_test() | |||
|
|||
@async_test | |||
async def test_retries(self): |
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.
Moved from tests/slack_sdk_async/web/test_web_client_http_retry.py to reduce confusion for future maintainers
@@ -54,8 +54,8 @@ async def _can_retry_async( | |||
*, | |||
state: RetryState, | |||
request: HttpRequest, | |||
response: Optional[HttpResponse], | |||
error: Optional[Exception], | |||
response: Optional[HttpResponse] = None, |
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.
for consistency
Codecov Report
@@ Coverage Diff @@
## main #1378 +/- ##
==========================================
+ Coverage 85.56% 85.57% +0.01%
==========================================
Files 111 111
Lines 11582 11586 +4
==========================================
+ Hits 9910 9915 +5
+ Misses 1672 1671 -1
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Summary
This pull request resolves #1377
Category (place an
x
in each of the[ ]
)/docs-src
(Documents, have you run./scripts/docs.sh
?)/docs-src-v2
(Documents, have you run./scripts/docs-v2.sh
?)/tutorial
(PythOnBoardingBot tutorial)tests
/integration_tests
(Automated tests for this library)Requirements (place an
x
in each[ ]
)python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh
after making the changes.