-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 #1525: add missing sub MultipartWriter headers #1530
fix #1525: add missing sub MultipartWriter headers #1530
Conversation
Current coverage is 98.85% (diff: 100%)@@ 1.2 #1530 diff @@
==========================================
Files 30 30
Lines 6984 6988 +4
Methods 0 0
Messages 0 0
Branches 1163 1165 +2
==========================================
+ Hits 6904 6908 +4
Misses 40 40
Partials 40 40
|
When appending MultipartWriter objects to another MultipartWriter use the subwriter's headers in the constructed BodyPartWriter fixes issue aio-libs#1525
f5bea57
to
1e71630
Compare
@kxepal not sure if you're the multipart owner, but this is related to the other multipart issue I raised. Ty |
@terencehonles eventually (: |
@kxepal but that's not what is currently written and written that way would actually make it more complicated in code. If multipart messages were nodes in the tree then they would have to know if they are the root node or not. If they were not the root node they would serialize their headers and body as the By keeping all serialization code in the If you think it is awkward that the user can find out that a The nice thing about how the code is currently written is |
@terencehonles Please, add few more tests about this change to let us remember about this use case. |
@kxepal sounds good 👍 |
@kxepal I'm not sure what needs to be done to satisfy those checks that failed |
@terencehonles |
@kxepal how do you even know what is covering it or not? This is not actually the case you are talking about because |
The codecov report says that with colors (;
I'm about |
@kxepal you're answering a slightly different question. I asked what is covering a line you're answering if a line is covered. We're talking about the same code path, but the only way to exercise that code path is to create a |
@terencehonles But anyway, yes, it seems the only way to cover those branch is to test BodyPartWriter constructor explicitly - that's not a problem, I think (: There were no else such tests because setup test suite and else tests did that job well. Not very unit approach, but quite dry. So that one should fill the blanks. Coverage report here doesn't lies, just tells which branches were not covered by test run. |
Unless you know what is covering a line and what data it was using there's a possibility it is not being meaningfully covered. The colors only show that some line in the test suite exercised the code not that it completely exercised it with the correct data (that's why I was wondering if there was a way to backtrack). I don't have enough time right now to look at the tests to figure out if this is currently a problem, but it's great that we even have as many tests as we do. |
@terencehonles The current failure seems to be not your fault, but some flaky test in webserver about serving static content. I triggered it retry. |
@kxepal it seems like we're not understanding each other, but it's not really something that needs to be continued on this PR. My point was we need to make sure we write tests to test the code not just to make the coverage tool show green. The tool helps us see what we might have missed, but I'm arguing it might be more generous than it should be when saying a line is "covered". Anyways, I'm fine leaving the discussion wherever it is :) |
@terencehonles Anyway, for current PR it all looks fine. +1 @asvetlov, any notes before merge? |
lgtm |
When appending MultipartWriter objects to another MultipartWriter use
the subwriter's headers in the constructed BodyPartWriter
fixes issue #1525
What do these changes do?
Fixes issue #1525 by allowing the wrapping BodyPartWriter to use the containing MultipartWriter's headers. This fixes the issue with the missing headers and also allows additional header changes until
.serialize()
is called.Are there changes in behavior for the user?
Documentation is now correct, and if the user previously explicitly passed the subwriter's headers when appending the object the headers will already be in the subwriter's headers object so it is effectively a no-op replacing existing values with their same values.
Related issue number
#1525
Checklist
CONTRIBUTORS.txt
CHANGES.rst
#issue_number
format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.