Error Handler tests#954
Merged
Merged
Conversation
Created test that make sure when error is already handled in local error handler, this don't await `ctx.send` to make sure that this don't move forward.
- Added `assertIsNone` to `test_error_handler_already_handled`. - Removed `ErrorHandlerTests.cog`, moved it to each test recreation.
Replaced `hasattr` with `getattr` for unit tests
Added `invoked_from_error_handler` attribute that is `False` default.
Added test for case when `Context.invoked_from_error_handler` is `True`
These 3 errors is: - `ConversionError` - `MaxConcurrencyReached` - `ExtensionError`
Senjan21
approved these changes
Feb 19, 2021
Contributor
Senjan21
left a comment
There was a problem hiding this comment.
Other than the one comment, tests look excellent to me, thanks.
Comment on lines
+63
to
+65
| if case["patch_verification_id"]: | ||
| with patch("bot.exts.backend.error_handler.Channels.verification", new=1234): | ||
| self.assertIsNone(await cog.on_command_error(self.ctx, error)) |
Contributor
There was a problem hiding this comment.
We don't have verification channel anymore so the this is redundant, same goes for any other part of the code that relates to patching verification channel id
We don't have a verification channel anymore, so this have no point and this just give errors.
Senjan21
approved these changes
Feb 20, 2021
Contributor
Senjan21
left a comment
There was a problem hiding this comment.
Changes look good, thanks for adding tests for newly introduced errors. Amazing quality overall! Thanks.
kosayoda
approved these changes
Apr 28, 2021
kosayoda
approved these changes
Apr 28, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #575
About PR
hasattrtogetattrto make testing possible.