-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add new option: pip wheel --save-wheel-names #6377
Conversation
95e8416
to
22b5de7
Compare
Also, i consider the name of this PR not very descriptive about what it does. Namely, it should contain the name of the added option. |
Thanks @hroncok for reviewing this! |
3b92d57
to
a849cf5
Compare
I think that functionality is done. May someone from pypa tell me what should be next step? By the way it seems that the failed CI test is not my fault. Build started |
hi, would you have time to look at this ? @pradyunsg |
@pradyunsg Hey. What can we do to move this forward? I think this looks good from our POV. |
@pradyunsg Please? |
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 added a few review comments.
Whoops! I've missed these notifications -- I'll take a look at this today evening. |
edfa759
to
f6924d2
Compare
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 this PR (and your patience) @PatrikKopkan! :) (and @hroncok for pinging me on this)
This PR seems to be failing on Windows (I have a suggestion inline to fix that) and the linter isn't super happy so please satisfy the linter. :P
This seems to be fairly complete functionally, and I don't have any major concerns there. I have made some inline comments about the details around the implementation / testing.
Please feel free to skip the comments starting with nit:
if you disagree with them. I'm nitpicking there, so please don't mind me. I'd hate for those to be something that causes friction. :)
tests/unit/test_wheel.py
Outdated
class TestWheelCommand(object): | ||
@patch('pip._internal.wheel.WheelBuilder') | ||
@patch('pip._internal.commands.wheel.RequirementSet') | ||
def test_save_wheelnames(self, mocked_rs, mocked_wb): |
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 test seems like it's going overboard with the mocking, etc, and as a result the test is a lot more complicated than it needs to be, IMO. Ideally, no calls to mock
or patch
should be needed. I would suggest changing save_wheelnames()
to accept path_to_wheelnames
and wheel_filenames
and use the tmpdir
fixture. Then instead of mocking open()
, just let save_wheelnames()
write a normal file, and check the file's contents at the end of the test. As for the RequirementSet
object, I would see if you can pick a signature for save_wheelnames()
that doesn't require mocking there, either. The body of the function only uses requirement_set.requirements.values()
, so if necessary you could have the function accept just the values. Or if it's easy to construct a requirement_set.requirements
object, you could have it accept requirements
. My intention in suggesting a separate function was to have a function that is easy to test while also testing most of the file-writing logic.
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.
Feedback of inexperienced contributor:
I admit that I am not familiar with philosophy of tests. My understanding of unit tests is that should check only tested function and should not rely on function calls of others function. When I saw there are directories dedicated to split the types of test(functional, unit) it misled me that the test should be done this way.
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.
Feedback of inexperienced contributor:
@PatrikKopkan The feedback helps. :)
The approach @cjerdonek describes is usually simpler to test on since all the function's "true" dependencies are surfaced and thus the need for mocking is reduced, while making it clearer at the call site what is actually being used.
Do you think that having some prose on this approach to testing would help new contributors understand this better?
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 might. Either way thanks for guiding me
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
I think it is ready for rereview. |
ISTM that the history of this PR isn't correct (eg 89f5adc is included but really shouldn't be). @PatrikKopkan could you look into that? |
c811d5d
to
17bf443
Compare
17bf443
to
9a2181a
Compare
@pradyunsg, Oh sorry |
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
@pradyunsg , thank you for help with merge conflict, is there something I could do? |
Hurrah! Thanks for following up on this @PatrikKopkan! ^>^ LGTM, and merged. :) |
Is this sufficient to satisfy the original use case
If so that would be my preference, since it has a couple benefits over the new argument as mentioned in #6340 (comment). The code prior to this change was already a bit tangled, so any concerns we can avoid adding benefit the general improvements we're doing in this area (see #7285 (comment) for an example). |
Yes, it does. I originally thought that option would be better but arguments made me realize that it is not good as I thought. |
PR for #6340