-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-68552: fix defects policy #138579
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
gh-68552: fix defects policy #138579
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
bitdancer
left a comment
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.
Thanks for working on this.
| yield | ||
|
|
||
| def get_defects(self, obj): | ||
| return obj.defects |
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.
It would be better to move this method to the TestCompat32 class.
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.
I have moved this to both TestCompat32 and TestDefectRaising - it was needed there as well.
| msg = self._str_msg(string) | ||
| self.assertEqual(len(self.get_defects(msg)), 1) | ||
| self.assertDefectsEqual(self.get_defects(msg), [defect]) | ||
| return msg |
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.
While this method does point toward a nice cleanup of the existing tests, I would do that cleanup in a different way. For this PR I would prefer to follow the existing pattern. Please remove this method and in-line the call to _raise_point following the pattern in the existing test methods.
| if msg: | ||
| headers = [('Subject', 'Dummy subject'), ('To', 'abc')] | ||
| self.assertEqual(msg.items(), headers) | ||
| self.assertEqual(msg.get_payload(), 'body\r\n') |
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.
As noted above, let's rewrite these to mirror the existing test pattern.
Lib/test/test_email/test_email.py
Outdated
| errors.NoBoundaryInMultipartDefect) | ||
| self.assertIsInstance(msg.defects[1], | ||
| errors.MultipartInvariantViolationDefect) | ||
|
|
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.
The test methods test_same_boundary_inner_outer and test_mulltipart_no_boundary are now also redundant and can be deleted.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @bitdancer: please review the changes made to this pull request. |
|
Looks good, but it needs a news entry. Something like "MisplacedEnvelopeHeaderDefect and 'Missing header name' defects are now correctly passed to the handle_defect method of policy". With appropriate formatting, of course. |
|
hi @bitdancer ! |
bitdancer
left a comment
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.
This looks fine. Technically you could link the defect and the method to the docs, but I don't think we need to go that far.
|
Thanks @nilleb for the PR, and @bitdancer for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @nilleb for the PR, and @bitdancer for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Extend defect handling via policy to a couple of missed defects. --------- (cherry picked from commit 9d707d8) Co-authored-by: Ivo Bellin Salarin <[email protected]> Co-authored-by: Martin Panter <[email protected]> Co-authored-by: Ivo Bellin Salarin <[email protected]>
Extend defect handling via policy to a couple of missed defects. --------- (cherry picked from commit 9d707d8) Co-authored-by: Ivo Bellin Salarin <[email protected]> Co-authored-by: Martin Panter <[email protected]> Co-authored-by: Ivo Bellin Salarin <[email protected]>
|
GH-142366 is a backport of this pull request to the 3.14 branch. |
|
GH-142367 is a backport of this pull request to the 3.13 branch. |
Co-authored-by: Ivo Bellin Salarin <[email protected]> Co-authored-by: Martin Panter <[email protected]> Co-authored-by: Ivo Bellin Salarin <[email protected]>
Co-authored-by: Ivo Bellin Salarin <[email protected]> Co-authored-by: Martin Panter <[email protected]> Co-authored-by: Ivo Bellin Salarin <[email protected]>
I am reporting in this pull request the fix made by @vadmium a long while ago.
(It wasn't clear which was the issue author expectation (@bitdancer) but I hope this will help taking a decision about the issue and eventually clean up the backlog.)
Thank you!