Skip to content

Commit 554902b

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

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
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 & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -691,33 +691,39 @@ def run_test(*args, **kwargs):
691691
return run_test
692692

693693

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

722728

723729
def clean_warning_registry():

0 commit comments

Comments
 (0)