10000 Tests raise Warnings in CI Linux py36_ubuntu_atlas · Issue #16685 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Tests raise Warnings in CI Linux py36_ubuntu_atlas #16685

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
cmarmo opened this issue Mar 13, 2020 · 6 comments
Closed

Tests raise Warnings in CI Linux py36_ubuntu_atlas #16685

cmarmo opened this issue Mar 13, 2020 · 6 comments

Comments

@cmarmo
Copy link
Contributor
cmarmo commented Mar 13, 2020

The build for Linux py36_ubuntu_atlas Azure pipeline, still raise warnings in test execution (see cmarmo/scikit-learn/#11).

+ python -m pytest --showlocals --durations=20 --junitxml=test-data.xml -Werror::DeprecationWarning -Werror::FutureWarning -Werror --pyargs sklearn
============================= test session starts ==============================
platform linux -- Python 3.6.9, pytest-5.2.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/vsts/work/tmp_folder, inifile: setup.cfg
    __import__(modname)
<frozen importlib._bootstrap>:971: in _find_and_load
    ???
<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:665: in _load_unlocked
    ???
../1/s/testvenv/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:142: in exec_module
    exec(co, module.__dict__)
../1/s/conftest.py:10: in <module>
    from distutils.version import LooseVersion
../1/s/testvenv/lib/python3.6/distutils/__init__.py:4: in <module>
    import imp
../1/s/testvenv/lib/python3.6/imp.py:33: in <module>
    DeprecationWarning, stacklevel=2)
E   DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

During handling of the above exception, another exception occurred:
../1/s/testvenv/lib/python3.6/site-packages/py/_path/common.py:383: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../1/s/testvenv/lib/python3.6/site-packages/py/_path/common.py:424: in gen
    dirs = self.optsort([p for p in entries
../1/s/testvenv/lib/python3.6/site-packages/py/_path/common.py:425: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
../1/s/testvenv/lib/python3.6/site-packages/_pytest/main.py:600: in _recurse
    ihook = self.gethookproxy(dirpath.dirpath())
../1/s/testvenv/lib/python3.6/site-packages/_pytest/main.py:424: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
../1/s/testvenv/lib/python3.6/site-packages/_pytest/config/__init__.py:434: in _getconftestmodules
    mod = self._importconftest(conftestpath)
../1/s/testvenv/lib/python3.6/site-packages/_pytest/config/__init__.py:470: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   _pytest.config.ConftestImportFailure: (local('/home/vsts/work/1/s/conftest.py'), (<class 'DeprecationWarning'>, DeprecationWarning("the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses",), <traceback object at 0x7fc80ad16288>))
--------- generated xml file: /home/vsts/work/tmp_folder/test-data.xml ---------
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.17s ===============================

@thomasjpfan
Copy link
Member

This looks like a module from python's standard library, (distutils) that is using a deprecated module (imp). I see two options:

  1. Vendor LooseVersion from python: https://github.com/python/cpython/blob/master/Lib/distutils/version.py which does not use imp.
  2. We can setup pytest to ignore warnings coming from Python modules, in this case distuils.

@cmarmo
Copy link
Contributor Author
cmarmo commented Mar 16, 2020

This looks like a module from python's standard library, (distutils) that is using a deprecated module (imp). I see two options:

  1. Vendor LooseVersion from python: https://github.com/python/cpython/blob/master/Lib/distutils/version.py which does not use imp.

  2. We can setup pytest to ignore warnings coming from Python modules, in this case distuils.

Thanks @thomasjpfan!
if I understand correctly, 2. is in line with @jnothman comment. I will go that direction if there are no objections.

@thomasjpfan
Copy link
Member

I am happy with option 2.

@cmarmo
Copy link
Contributor Author
cmarmo commented Jul 3, 2020

Merging #17670 removed this error, but the build is still affected by an ImportWarning:

+ python -m pytest --showlocals --durations=20 --junitxml=test-data.xml -Werror --pyargs sklearn
============================= test session starts ==============================
platform linux -- Python 3.6.9, pytest-5.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/vsts/work/tmp_folder, inifile: setup.cfg
../1/s/sklearn/__init__.py:80: in <module>
    from .base import clone
../1/s/sklearn/base.py:17: in <module>
    from .utils import _IS_32BIT
../1/s/sklearn/utils/__init__.py:20: in <module>
    from scipy.sparse import issparse
/usr/lib/python3/dist-packages/scipy/__init__.py:114: in <module>
    from scipy._lib._ccallback import LowLevelCallable
/usr/lib/python3/dist-packages/scipy/_lib/_ccallback.py:1: in <module>
    from . import _ccallback_c
scipy/_lib/_ccallback_c.pyx:210: in init scipy._lib._ccallback_c (scipy/_lib/_ccallback_c.c:3479)
    ???
E   ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__

During handling of the above exception, another exception occurred:
../1/s/testvenv/lib/python3.6/site-packages/py/_path/common.py:383: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../1/s/testvenv/lib/python3.6/site-packages/py/_path/common.py:424: in gen
    dirs = self.optsort([p for p in entries
../1/s/testvenv/lib/python3.6/site-packages/py/_path/common.py:425: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
../1/s/testvenv/lib/python3.6/site-packages/_pytest/main.py:616: in _recurse
    ihook = self.gethookproxy(dirpath.dirpath())
../1/s/testvenv/lib/python3.6/site-packages/_pytest/main.py:446: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
../1/s/testvenv/lib/python3.6/site-packages/_pytest/config/__init__.py:399: in _getconftestmodules
    mod = self._importconftest(conftestpath.realpath())
../1/s/testvenv/lib/python3.6/site-packages/_pytest/config/__init__.py:438: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   _pytest.config.ConftestImportFailure: (local('/home/vsts/work/1/s/conftest.py'), (<class 'ImportWarning'>, ImportWarning("can't resolve package from __spec__ or __package__, falling back on __name__ and __path__",), <traceback object at 0x7ff7c084f988>))
--------- generated xml file: /home/vsts/work/tmp_folder/test-data.xml ---------
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.30 seconds ============================

I suppose I should move to ignoring ImportWarning from scipy...

@thomasjpfan
Copy link
Member

We normally do not set -Werror and use -Werror::DeprecationWarning -Werror::FutureWarning.

The import warning is strange given that it came from import issparse.

@cmarmo
Copy link
Contributor Author
cmarmo commented Aug 22, 2020

Ok, this is not worth to fix, definitely: see scipy/#11000.
Sorry for the noise, I'm closing this.

@cmarmo cmarmo closed this as completed Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0