|
49 | 49 | from sklearn.utils.fixes import signature
|
50 | 50 | from sklearn.utils import deprecated
|
51 | 51 |
|
52 |
| -import pytest |
53 |
| - |
54 | 52 |
|
55 | 53 | additional_names_in_all = []
|
56 | 54 | try:
|
@@ -691,33 +689,39 @@ def run_test(*args, **kwargs):
|
691 | 689 | return run_test
|
692 | 690 |
|
693 | 691 |
|
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 |
721 | 725 |
|
722 | 726 |
|
723 | 727 | def clean_warning_registry():
|
|
0 commit comments