8000 [MRG] TST Remove test_import_sklearn_no_warnings by rth · Pull Request #12244 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG] TST Remove test_import_sklearn_no_warnings #12244

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions sklearn/tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Basic unittests to test functioning of module's top-level

import subprocess

import pkgutil

import pytest

import sklearn
from sklearn.utils.testing import assert_equal

__author__ = 'Yaroslav Halchenko'
Expand All @@ -25,37 +18,3 @@ def test_import_skl():
# "import *" is discouraged outside of the module level, hence we
# rely on setting up the variable above
assert_equal(_top_import_error, None)


def test_import_sklearn_no_warnings():
# Test that importing scikit-learn main modules doesn't raise any warnings.

try:
pkgs = pkgutil.iter_modules(path=sklearn.__path__, prefix='sklearn.')
import_modules = '; '.join(['import ' + modname
for _, modname, _ in pkgs
if (not modname.startswith('_') and
# add deprecated top level modules
# below to ignore them
modname not in [])])

message = subprocess.check_output(['python', '-Wdefault',
'-c', import_modules],
stderr=subprocess.STDOUT)
message = message.decode("utf-8")
message = '\n'.join([line for line in message.splitlines()
if not (
# ignore ImportWarning due to Cython
"ImportWarning" in line or
# ignore DeprecationWarning due to pytest
"pytest" in line or
# ignore DeprecationWarnings due to
# numpy.oldnumeric
"oldnumeric" in line
)])
assert 'Warning' not in message
assert 'Error' not in message

except Exception as e:
pytest.skip('soft-failed test_import_sklearn_no_warnings.\n'
' %s, \n %s' % (e, message))
0