-
-
Couldn't load subscription status.
- Fork 33.2k
gh-80793: Edit unittest.rst on SetUpClass calls #12798
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I fail at blurb. How can I fix? |
This comment was marked as resolved.
This comment was marked as resolved.
Misc/NEWS.d/next/Documentation/2019-04-12-12-30-08.bpo-36612.8AGXVv.rst
Outdated
Show resolved
Hide resolved
|
Hi, @vrpolakatcisco ,it is no need to add a 'skip news' in Misc/NEWS.d. A core dev would review your commit and add a 'skip news' tag on the PR. |
d3b7c16 to
1afa8fa
Compare
Well, my plan was to do a clean rebase. Not sure what to do with the "sync" merge commit. |
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 trying to enhance the documentation! I propose to simplify further, as it's only normal rules.
Doc/library/unittest.rst
Outdated
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.
Same, what are you trying to clarify? As said in b.p.o normal inheritance rules apply. I think we should be explicit about inheritance only when "anormal rule apply", not every time "normal" rules apply.
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 original formulation
"These must be implemented as class methods"
sounds like normal rules do not apply for some reason, and each class needs to have an implementation (even if it only calls ancestor implementation).
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.
sounds like normal rules do not apply for some reason
Yes, it tells it's not a method but a class method, it reminds you not to forgot to add the @classmethod, the original wording is OK.
and each class needs to have an implementation (even if it only calls ancestor implementation)
Can you proove it with an example?
Doc/library/unittest.rst
Outdated
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.
Same here, let's not be explicit about this being normal (if we're explicit here about the inheritance working normally, why not adding it everywhere else on the doc? No.)
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 original formulation
"you must call up to them yourself"
once again sounds like normal rules do not apply for some reason, and you have to make the call explicit, instead of relying on inheritance.
if we're explicit here about the inheritance working normally, why not adding it everywhere else on the doc?
I agree that confirming something is normal creates doubts on other (not explicitly confirmed things).
I am going to propose different edits, focusing on just removing the "wrong sounding" formulations.
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.
once again sounds like normal rules do not apply for some reason
I agree.
and you have to make the call explicit, instead of relying on inheritance
Inheritance never "call implicitly", as long as you re-implement the method, you have to call the parent implementation manually. But if you don't implement a method, the parent one is just inherited and no manual actions are needed. Only normal rules here.
|
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 |
1afa8fa to
c3e84ec
Compare
|
FYI, |
Doc/library/unittest.rst
Outdated
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.
Why removing the "if there is one"? It was right:
tearDownClass = getattr(previousClass, 'tearDownClass', None)
if tearDownClass is not None:
...
I don't see any problem with this paragraph, and it looks not correlated with bpo-36612.
Doc/library/unittest.rst
Outdated
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.
Looks unrelated to the issue, and I don't see how the new wording helps.
Doc/library/unittest.rst
Outdated
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 prefer the original wording.
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.
Not sure why module functions have "should" and class methods have "must", but I think I can make do edits also without affecting these two lines.
Doc/library/unittest.rst
Outdated
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 sentence is right, the implementations are present but empty. But now without context I don't see the point of mentioning it, why not removing it all?
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 will expand in next version.
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.
Honestly this still doesn't sound very useful to me. The new text doesn't really answer the question in the original bug report.
The previous formulations could suggest that some special rules apply for the class methods as opposed to the normal inheritance rules. The formulations are tweaked by this patch, hinting the normal inheritance rules indeed apply. Sentences describing module functions are also tweaked, to signify the logic (almost) the same as for class methods. Signed-off-by: Vratko Polak <[email protected]>
c2526ff to
bb63073
Compare
| ``tearDownModule`` are run. | ||
|
|
||
| The abovementioned calls are only executed, | ||
| if the corresponding method or function is found. |
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.
Choosing "method is found", instead of "method exists" or "class has a method", in order to hint method resolution order is in effect.
| then you must call up to them yourself. The implementations in | ||
| :class:`TestCase` are empty. | ||
| The implementations in :class:`TestCase` are present, but empty. | ||
| That means the implemenation is executed for classes descending from |
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.
Choosing "descending" instead of "derived" or "child", to suggest the inheritance graphs can be complicated.
| :class:`TestCase` are empty. | ||
| The implementations in :class:`TestCase` are present, but empty. | ||
| That means the implemenation is executed for classes descending from | ||
| :class:`TestCase`, but the implementation does not do anything, |
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.
Empty implementation executed means no special handling is there to interfere with normal inheritance rules.
|
This PR has been languishing. I'm going to go ahead and close the PR and associated issue. Thanks @vrpolakatcisco for the report and the PR. |
Signed-off-by: Vratko Polak [email protected]