-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Include version in deprecation warnings #6218
Include version in deprecation warnings #6218
Conversation
Adding tests for the case when exceptions are raised. |
9263bb4
to
eb8b275
Compare
@cjerdonek Could you take a look at this PR? |
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.
Some comments.
@@ -83,8 +83,10 @@ def deprecated(reason, replacement, gone_in, issue=None): | |||
if issue is not None: | |||
url = "https:/pypa/pip/issues/" + str(issue) | |||
message += " You can find discussion regarding this at {}.".format(url) | |||
if gone_in is not None: | |||
message += " pip {} will remove this functionality.".format(gone_in) |
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 think the most important information should be listed first. So that would be (1) the version in which it was / will be removed, (2) then the replacement, and (3) ending with where to go for more info.
message += " pip {} will remove this functionality.".format(gone_in) | ||
# Raise as an error if it has to be removed. | ||
if parse(current_version) >= parse(gone_in): | ||
raise PipDeprecationWarning(message) |
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.
In this case, I would make the message say, "was removed in" instead of "will be."
|
||
assert "DEPRECATION: Stop doing this!" in message | ||
# Ensure non-None values are mentioned. | ||
for item in [gone_in, replacement, issue]: |
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.
With this combinatorial way of testing, it's hard to visualize what the full message looks like, so, in addition to the test testing the various combinations, I would add one separate test with all the information present testing an exact match on the string. That gives maintainers a way to check the message as a whole. I would do one test like this for the exception case and one test for the "will be" case.
This isn't critical path for 19.0.2. |
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 |
Closing this and creating a new PR because I'm bored. |
The warning getting raised, would only be seen by the maintainers, right? I don't think we need to do this. |
More because it was easier to copy-paste than fiddle around with git-rebase for such a small PR. I was too lazy to write that. |
Closes #6216