-
Notifications
You must be signed in to change notification settings - Fork 24
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
test: Don't assert error messages #570
Conversation
They are subject to change, so checking the error code is enough to know that the expected error occurred. Signed-off-by: Lewis Marshall <[email protected]>
WalkthroughThe change involves an update to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
LGTM
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
test/ably/rest/restchannels_test.py (1)
90-90
: Approve change and suggest minor improvementThe modification successfully addresses the PR objective by asserting the error code instead of the error message. This approach makes the test more robust against potential changes in error message wording.
However, there's a minor style improvement we can make:
Consider rewriting the assertion to avoid the Yoda condition:
- assert 40160 == excinfo.value.code + assert excinfo.value.code == 40160This change aligns better with conventional Python style guidelines.
Would you like me to implement this change for you?
🧰 Tools
🪛 Ruff
90-90: Yoda condition detected
Rewrite as
excinfo.value.code == 40160
(SIM300)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- test/ably/rest/restchannels_test.py (1 hunks)
🧰 Additional context used
🪛 Ruff
test/ably/rest/restchannels_test.py
90-90: Yoda condition detected
Rewrite as
excinfo.value.code == 40160
(SIM300)
I don't think the test suite will pass here due to the issue raised in #569 (i.e. ably-python won't properly decode msgpack encoded error responses, and so error code checks don't match up), but the change here is a correct one. |
They are subject to change, so checking the error code is enough to know that the expected error occurred.
Summary by CodeRabbit
test_without_permissions
function to validate error codes instead of exception message content.