Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Re-evaluate treating DeprecationWarnings as errors #12043

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
rth opened this issue Sep 8, 2018 · 2 comments
Closed

Re-evaluate treating DeprecationWarnings as errors #12043

rth opened this issue Sep 8, 2018 · 2 comments
Milestone

Comments

@rth
Copy link
Member

rth commented Sep 8, 2018

Currently any raised DeprecationWarning makes the test suite fail due to the pytest settings in setup.cfg.

Opening this issue to see whether we want to keep this setup in the future. In my opinion it is too strict, and prone to failures due to reasons we can't control.

For instance, consider the following use case from #12041 . After installing numpy 1.8.2 and scipy 0.13.3 (minimal versions supported by scikit-learn), the importing scipy.sparse raises a deprecation warning,

python -W error -c "import scipy.sparse"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/rth/.miniconda3/envs/test-32/lib/python2.7/site-packages/scipy/__init__.py", line 77, in <module>
    from numpy import oldnumeric
  File "/home/rth/.miniconda3/envs/test-32/lib/python2.7/site-packages/numpy/oldnumeric/__init__.py", line 11, in <module>
    warnings.warn(_msg, ModuleDeprecationWarning)
numpy.ModuleDeprecationWarning: The oldnumeric module will be dropped in Numpy 1.9

Because scipy.sparse is indirectly imported in sklearn.__init__, this means that, technically, the test suite will always fails for these numpy & scipy versions. The only reason why it passed so far was due to a pytest limitation/bug (pytest-dev/pytest#3251). The workaround that we can use, now that that issue is fixed in pytest, is fairly awkward #12042.

This is just an example, but it illustrates that once 0.20 is released, with the current setting, running the test suite in some undetermined Python environment is likely to produce failures that are not representative.

Removing the setup.cfg altogether as it's done in Appveyor is also not ideal, as then e.g. the --doctest-modules option is also removed.

Possibly keeping this configuration for the CI and then removing it from the final .tar.gz before the release could work?
Another solution could be to fail only on DeprecationWarnings raised within scikit-learn code (if that's technically possible).

cc @jnothman @amueller

@rth rth added this to the 0.20 milestone Sep 8, 2018
@jnothman
Copy link
Member

jnothman commented Sep 8, 2018 via email

@rth
Copy link
Member Author

rth commented Sep 10, 2018

It only makes sense to fail on warnings with the latest dependencies, IMO.

Made a PR to change this in #12048

Another use case where the current setup is problematic is e.g. running tests on PyPy. Currently there are test failures in #12039 because of DeprecationWarnings coming from PyPy that we don't really care about due to "fail on DeprecationWarning" setting hardcoded in setup.cfg.

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

No branches or pull requests

2 participants