Skip to content

[MRG+1] TST Ignore DeprecationWarning in test_auc_duplicate_values #11580

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

Closed
wants to merge 2 commits into from
Closed

[MRG+1] TST Ignore DeprecationWarning in test_auc_duplicate_values #11580

wants to merge 2 commits into from

Conversation

qinhanmin2014
Copy link
Member

Fixes #11572
See #11572 (comment) for details

@qinhanmin2014 qinhanmin2014 added this to the 0.20 milestone Jul 17, 2018
@qinhanmin2014 qinhanmin2014 changed the title TST Ignore DeprecationWarning in test_auc_duplicate_values [MRG] TST Ignore DeprecationWarning in test_auc_duplicate_values Jul 17, 2018
@GaelVaroquaux GaelVaroquaux changed the title [MRG] TST Ignore DeprecationWarning in test_auc_duplicate_values [MRG+1] TST Ignore DeprecationWarning in test_auc_duplicate_values Jul 17, 2018
Copy link
Member

@GaelVaroquaux GaelVaroquaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base on the discussion in
#11572 (comment)

this looks good to me, and I am +1 for merge.

@amueller
Copy link
Member

that's also the fix I've used in #11570 now btw. That contains fixes for all deprecation warnings in the tests.

@lesteve
Copy link
Member

lesteve commented Jul 17, 2018

I pushed a fix having to do with a slightly dangerous caveat of ignore_warnings: if you pass the warning class as the first argument, then the test is not run:

from sklearn.utils.testing import ignore_warnings

@ignore_warnings(UserWarning)
def test():
    1/0
❯ pytest /tmp/test.py
======================================================== test session starts ========================================================
platform linux -- Python 3.6.5, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
rootdir: /tmp, inifile:
plugins: cov-2.5.1, hypothesis-3.56.0
collected 0 items                                                                                                                   

=================================================== no tests ran in 0.14 seconds ====================================================

The reason is that the first argument is the test callable. Maybe that could be fixed not sure.

@qinhanmin2014
Copy link
Member Author

Sorry @amueller for not checking your work carefully.
Thanks @lesteve (I don't have time to check it tonight but I definitely trust you). I should have used recommended pytest.mark.filterwarnings. Maybe you should also post your comment to #11570.

@rth
Copy link
Member

rth commented Jul 17, 2018

I pushed a fix having to do with a slightly dangerous caveat of ignore_warnings:

Yes, that is very tricky, I would have missed that in review as well. I agree, we should try to switch to pytest.mark.filterwarnings if possible.

@lesteve
Copy link
Member

lesteve commented Jul 17, 2018

The limitation with the pytest.mark.filterwarnings can only be used at a test level. There is no way to use a context manager, which sometimes is convenient when you just want to ignore a warning for a few lines.

@qinhanmin2014
Copy link
Member Author

Resolved in #11570

@qinhanmin2014 qinhanmin2014 deleted the auc-test branch July 17, 2018 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants