8000 TST Skip some doctests if pillow not installed (#15131) · crankycoder/scikit-learn@fdbaa58 · GitHub
[go: up one dir, main page]

Skip to content

Commit fdbaa58

Browse files
rththomasjpfan
authored andcommitted
TST Skip some doctests if pillow not installed (scikit-learn#15131)
1 parent 3753e6c commit fdbaa58

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

build_tools/azure/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ elif [[ "$DISTRIB" == "conda-pip-latest" ]]; then
9393
make_conda "python=$PYTHON_VERSION"
9494
python -m pip install numpy scipy joblib cython
9595
python -m pip install pytest==$PYTEST_VERSION pytest-cov pytest-xdist
96-
python -m pip install pandas matplotlib pyamg pillow
96+
python -m pip install pandas matplotlib pyamg
9797
fi
9898

9999
if [[ "$COVERAGE" == "true" ]]; then

conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from sklearn import set_config
1515
from sklearn.utils import _IS_32BIT
16+
from sklearn.externals import _pilutil
1617

1718
PYTEST_MIN_VERSION = '3.3.0'
1819

@@ -68,6 +69,13 @@ def pytest_collection_modifyitems(config, items):
6869
for item in items:
6970
if isinstance(item, DoctestItem):
7071
item.add_marker(skip_marker)
72+
elif not _pilutil.pillow_installed:
73+
skip_marker = pytest.mark.skip(reason="pillow (or PIL) not installed!")
74+
for item in items:
75+
if item.name in [
76+
"sklearn.feature_extraction.image.PatchExtractor",
77+
"sklearn.feature_extraction.image.extract_patches_2d"]:
78+
item.add_marker(skip_marker)
7179

7280

7381
def pytest_configure(config):

0 commit comments

Comments
 (0)
0