Skip to content

Commit

Permalink
MAINT fix sklearn test setup (#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrisel committed Feb 7, 2022
1 parent 47e0f54 commit 732923a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
linux_py39_sklearn_tests:
imageName: 'ubuntu-latest'
PYTHON_VERSION: "3.9"
EXTRA_CONDA_PACKAGES: "numpy"
# SKIP_TESTS: "true"
SKLEARN_TESTS: "true"
linux_py38_distributed:
Expand Down
25 changes: 18 additions & 7 deletions continuous_integration/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,34 @@ if [[ "$SKIP_TESTS" != "true" ]]; then
fi

if [[ "$SKLEARN_TESTS" == "true" ]]; then
# Install scikit-learn from conda and test against the installed
# Install the nightly build of scikit-learn and test against the installed
# development version of joblib.
conda remove -y numpy
conda install -y -c conda-forge cython pillow pip numpy scipy
# TODO: unpin pip once either https://github.com/pypa/pip/issues/10825
# accepts invalid HTML or Anaconda is fixed.
conda install -y -c conda-forge cython pillow numpy scipy "pip<22"
pip install --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn
python -c "import sklearn; print('Testing scikit-learn', sklearn.__version__)"

# Move to a dedicated folder to avoid being polluted by joblib specific conftest.py
# and disable the doctest plugin to avoid issues with doctests in scikit-learn
# docstrings that require setting print_changed_only=True temporarily.
cd "/tmp"
NEW_TEST_DIR=$(mktemp -d)
cd $NEW_TEST_DIR

pytest -vl --maxfail=5 -p no:doctest \
# Don't worry about deprecated imports: this is tested for real
# in upstream scikit-learn and this is not joblib's responsibility.
# Let's skip this test to avoid false positives in joblib's CI.
-k "not test_import_is_deprecated" \
-k "not test_check_memory" \
--pyargs sklearn

# Justification for skipping some tests:
#
# test_import_is_deprecated: Don't worry about deprecated imports: this is
# tested for real in upstream scikit-learn and this is not joblib's
# responsibility. Let's skip this test to avoid false positives in joblib's
# CI.
#
# test_check_memory: scikit-learn test need to be updated to avoid using
# cachedir: https://github.com/scikit-learn/scikit-learn/pull/22365
fi

if [[ "$SKIP_TESTS" != "true" && "$COVERAGE" == "true" ]]; then
Expand Down

0 comments on commit 732923a

Please sign in to comment.