11# Basic unittests to test functioning of module's top-level
22
3- import subprocess
4-
5- import pkgutil
6-
7- import pytest
8-
9- import sklearn
103from sklearn .utils .testing import assert_equal
114
125__author__ = 'Yaroslav Halchenko'
@@ -25,37 +18,3 @@ def test_import_skl():
2518 # "import *" is discouraged outside of the module level, hence we
2619 # rely on setting up the variable above
2720 assert_equal (_top_import_error , None )
28-
29-
30- def test_import_sklearn_no_warnings ():
31- # Test that importing scikit-learn main modules doesn't raise any warnings.
32-
33- try :
34- pkgs = pkgutil .iter_modules (path = sklearn .__path__ , prefix = 'sklearn.' )
35- import_modules = '; ' .join (['import ' + modname
36- for _ , modname , _ in pkgs
37- if (not modname .startswith ('_' ) and
38- # add deprecated top level modules
39- # below to ignore them
40- modname not in [])])
41-
42- message = subprocess .check_output (['python' , '-Wdefault' ,
43- '-c' , import_modules ],
44- stderr = subprocess .STDOUT )
45- message = message .decode ("utf-8" )
46- message = '\n ' .join ([line for line in message .splitlines ()
47- if not (
48- # ignore ImportWarning due to Cython
49- "ImportWarning" in line or
50- # ignore DeprecationWarning due to pytest
51- "pytest" in line or
52- # ignore DeprecationWarnings due to
53- # numpy.oldnumeric
54- "oldnumeric" in line
55- )])
56- assert 'Warning' not in message
57- assert 'Error' not in message
58-
59- except Exception as e :
60- pytest .skip ('soft-failed test_import_sklearn_no_warnings.\n '
61- ' %s, \n %s' % (e , message ))
0 commit comments