8000 Merge branch 'pytest-parametrize-part1' into pytest-parametrize-non-c… · scikit-learn/scikit-learn@fbfb976 · GitHub
[go: up one dir, main page]

Skip to content

Commit fbfb976

Browse files
committed
Merge branch 'pytest-parametrize-part1' into pytest-parametrize-non-common-tests
2 parents f96210a + 0bc2ccb commit fbfb976

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

sklearn/ensemble/tests/test_forest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
FOREST_ESTIMATORS.update(FOREST_REGRESSORS)
9898
FOREST_ESTIMATORS.update(FOREST_TRANSFORMERS)
9999

100-
FOREST_CLASSIFIERS_REGRESSORS = dict(FOREST_CLASSIFIERS, **FOREST_REGRESSORS)
100+
FOREST_CLASSIFIERS_REGRESSORS = FOREST_CLASSIFIERS.copy()
101+
FOREST_CLASSIFIERS_REGRESSORS.update(FOREST_REGRESSORS)
101102

102103

103104
def check_classification_toy(name):

sklearn/utils/testing.py

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
from sklearn.utils.fixes import signature
5050
from sklearn.utils import deprecated
5151

52-
import pytest
53-
5452

5553
additional_names_in_all = []
5654
try:
@@ -691,33 +689,39 @@ def run_test(*args, **kwargs):
691689
return run_test
692690

693691

694-
skip_if_32bit = pytest.mark.skipif(8 * struct.calcsize("P") == 32,
695-
reason='skipped on 32bit platforms')
696-
skip_travis = pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
697-
reason='skip on travis')
698-
699-
700-
# Decorator for tests involving both BLAS calls and multiprocessing.
701-
#
702-
# Under POSIX (e.g. Linux or OSX), using multiprocessing in conjunction with
703-
# some implementation of BLAS (or other libraries that manage an internal
704-
# posix thread pool) can cause a crash or a freeze of the Python process.
705-
#
706-
# In practice all known packaged distributions (from Linux distros or
707-
# Anaconda) of BLAS under Linux seems to be safe. So we this problem seems to
708-
# only impact OSX users.
709-
#
710-
# This wrapper makes it possible to skip tests that can possibly cause
711-
# this crash under OS X with.
< 8000 /td>
712-
#
713-
# Under Python 3.4+ it is possible to use the `forkserver` start method
714-
# for multiprocessing to avoid this issue. However it can cause pickling
715-
# errors on interactively defined functions. It therefore not enabled by
716-
# default.
717-
718-
if_safe_multiprocessing_with_blas = pytest.mark.skipif(
719-
sys.platform == 'darwin',
720-
reason="Possible multi-process bug with some BLAS")
692+
try:
693+
import pytest
694+
695+
skip_if_32bit = pytest.mark.skipif(8 * struct.calcsize("P") == 32,
696+
reason='skipped on 32bit platforms')
697+
skip_travis = pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
698+
reason='skip on travis')
699+
700+
# Decorator for tests involving both BLAS calls and multiprocessing.
701+
#
702+
# Under POSIX (e.g. Linux or OSX), using multiprocessing in conjunction
703+
# with some implementation of BLAS (or other libraries that manage an
704+
# internal posix thread pool) can cause a crash or a freeze of the Python
705+
# process.
706+
#
707+
# In practice all known packaged distributions (from Linux distros or
708+
# Anaconda) of BLAS under Linux seems to be safe. So we this problem seems
709+
# to only impact OSX users.
710+
#
711+
# This wrapper makes it possible to skip tests that can possibly cause
712+
# this crash under OS X with.
713+
#
714+
# Under Python 3.4+ it is possible to use the `forkserver` start method
715+
# for multiprocessing to avoid this issue. However it can cause pickling
716+
# errors on interactively defined functions. It therefore not enabled by
717+
# default.
718+
719+
if_safe_multiprocessing_with_blas = pytest.mark.skipif(
720+
sys.platform == 'darwin',
721+
reason="Possible multi-process bug with some BLAS")
722+
723+
except ImportError:
724+
pass
721725

722726

723727
def clean_warning_registry():

0 commit comments

Comments
 (0)
0