Add TypeError for bare @requires_crt usage and regression tests#4734
Merged
jonathan343 merged 2 commits intoboto:developfrom Mar 11, 2026
Merged
Add TypeError for bare @requires_crt usage and regression tests#4734jonathan343 merged 2 commits intoboto:developfrom
jonathan343 merged 2 commits intoboto:developfrom
Conversation
jonathan343
approved these changes
Mar 11, 2026
| def my_test(): | ||
| pass | ||
|
|
||
| assert not getattr(my_test, '__unittest_skip__', False) |
Contributor
There was a problem hiding this comment.
nit - Minor style preference to be consistent with the is True above
Suggested change
| assert not getattr(my_test, '__unittest_skip__', False) | |
| assert getattr(my_test, '__unittest_skip__', False) is False |
Contributor
Author
There was a problem hiding this comment.
Both description and code updated. Thanks for the suggestion!
…rt regression tests
hswong3i
pushed a commit
to alvistack/boto-boto3
that referenced
this pull request
Mar 12, 2026
…#4734) * Add TypeError for bare @requires_crt usage and regression tests * use `is False` for consistency with `is True` assertion in requires_crt regression tests
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.
Background:
@requires_crtis used to skip tests when the optional CRT dependency is not installed. The only supported form should be@requires_crt(). Using bare@requires_crtis unsafe becauserequires_crtis implemented as a decorator factory. Python passes the test function as thereasonargument, causing the real test body to never run. Assertions are never evaluated, but the test may still appear to pass or skip silently.Description of changes:
This PR makes bare
@requires_crtfail immediately with aTypeError. All existing usages in boto3 already use@requires_crt()with parentheses.Testing:
Regression tests are added to verify correct behavior. All tests including the new tests pass.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.