[MRG + 1] Prevent nose from using docstring to name the tests in results#4250
[MRG + 1] Prevent nose from using docstring to name the tests in results#4250raghavrv wants to merge 0 commit intoscikit-learn:masterfrom
Conversation
cd8808d to
5a07dde
Compare
|
This is interesting... For test generators, one is able to set test_function.description to override the docstring. However as here, you need the function to be copied (perhaps by |
|
This adds a dependency for testing. Therefore I am -1 |
|
How about we simply convert all docstrings to comments instead...? |
|
How about we simply convert all docstrings to comments instead...?
That would be great!
|
|
I guess I'm also +1 on just using comments everywhere. |
|
FYI when I introduced the generators into the common tests, I was thinking about a nice way to set the names. A decorator for the check functions would probably be a nice and easy solution. |
… to avoid description ptoblems with nose (Related to issue #4250)
8297dec to
3a62aa3
Compare
|
@amueller @jnothman Do you feel decorators for generators are needed? For this test and a generator without description set to it... def test_discretenb_partial_fit():
for cls in [MultinomialNB, BernoulliNB]:
yield check_partial_fit, clsThe output when it passes is - The output when it fails is - |
|
decorators are for another PR. |
|
But do you think we need them? given that, with a decorator, we simply get the description unlike the more detailed |
|
yes, I think they would be good, if we can keep the name of the estimator in the string. If not, you are right. Maybe that was the reason why I didn't go for the decorator approach. |
|
The thing is that you don't know which check is running from the output, and for example which one gives a warning or takes long etc. |
a1972a8 to
451e1b6
Compare
|
@amueller Could you take a look at this one? I know this has a huge diff, but should be easy to review since this just changes docstring to comments... (Kindly review the last two commits separately as they are not related to the docstring --> comment conversion) |
|
Also as you had suggested, I'll make a separate PR for the decorator for test gens.! |
|
apart from inline comment lgtm |
|
Done! Please take a final look! @ogrisel could I trouble you for a 2nd review? |
|
looks fine now. |
|
@ogrisel Any reviews? (sorry to trouble you with multiple PR review requests :p) |
|
can you rebase please? |
c575676 to
07d6e27
Compare
|
Done :) |
764c640 to
3b32099
Compare
… to avoid description ptoblems with nose (Related to issue scikit-learn#4250)
ISSUE
When docstrings are added to
test_*functions, nose uses them as headers when a particular test fails. This is not very convenient, compared to the function name and the passed arguments (in case of generators).And also as pointed out in the link shared by Joel, test generators do not respect the generators docstring... Most generators use naming similar to
check_*. Docstrings need not be removed in such cases.Whether the generators need to be decorated by a method which sets its description is debatable.
FIX
@test_describe('description')( ? )@amueller @ogrisel Please take a look