2014-04-03 17:14:28 +08:00
|
|
|
#!/bin/bash
|
2014-04-03 20:59:26 +08:00
|
|
|
# This script is meant to be called by the "script" step defined in
|
2018-10-04 22:37:57 +08:00
|
|
|
# .travis.yml. See https://docs.travis-ci.com/ for more details.
|
2014-04-03 20:59:26 +08:00
|
|
|
# The behavior of the script is controlled by environment variabled defined
|
|
|
|
|
# in the .travis.yml in the top level folder of the project.
|
2014-04-03 17:14:28 +08:00
|
|
|
|
2014-08-19 16:49:59 +08:00
|
|
|
# License: 3-clause BSD
|
|
|
|
|
|
2014-04-03 17:14:28 +08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
python --version
|
|
|
|
|
python -c "import numpy; print('numpy %s' % numpy.__version__)"
|
|
|
|
|
python -c "import scipy; print('scipy %s' % scipy.__version__)"
|
2016-09-29 00:46:46 +08:00
|
|
|
python -c "\
|
|
|
|
|
try:
|
|
|
|
|
import pandas
|
|
|
|
|
print('pandas %s' % pandas.__version__)
|
|
|
|
|
except ImportError:
|
|
|
|
|
pass
|
|
|
|
|
"
|
2020-07-31 16:11:27 +08:00
|
|
|
python -c "import joblib; print(joblib.cpu_count(), 'CPUs')"
|
|
|
|
|
python -c "import platform; print(platform.machine())"
|
2014-04-03 17:14:28 +08:00
|
|
|
|
2020-07-10 22:10:10 +08:00
|
|
|
if [[ "$BUILD_WITH_ICC" == "true" ]]; then
|
|
|
|
|
# the tools in the oneAPI toolkits are configured via environment variables
|
|
|
|
|
# which are also required at runtime.
|
|
|
|
|
source /opt/intel/inteloneapi/setvars.sh
|
|
|
|
|
fi
|
|
|
|
|
|
2016-08-30 10:59:57 +08:00
|
|
|
run_tests() {
|
2017-11-17 03:20:35 +08:00
|
|
|
TEST_CMD="pytest --showlocals --durations=20 --pyargs"
|
|
|
|
|
|
2017-04-03 18:20:04 +08:00
|
|
|
# Get into a temp directory to run test from the installed scikit-learn and
|
2016-08-30 10:59:57 +08:00
|
|
|
# check if we do not leave artifacts
|
|
|
|
|
mkdir -p $TEST_DIR
|
2017-11-17 03:20:35 +08:00
|
|
|
# We need the setup.cfg for the pytest settings
|
2016-08-30 10:59:57 +08:00
|
|
|
cp setup.cfg $TEST_DIR
|
|
|
|
|
cd $TEST_DIR
|
|
|
|
|
|
2020-07-31 16:11:27 +08:00
|
|
|
if [[ "$TRAVIS_CPU_ARCH" == "arm64" ]]; then
|
|
|
|
|
# use pytest-xdist for faster tests
|
|
|
|
|
TEST_CMD="$TEST_CMD -n $CI_CPU_COUNT"
|
|
|
|
|
else
|
|
|
|
|
# Tests that require large downloads over the networks are skipped in CI.
|
|
|
|
|
# Here we make sure, that they are still run on a regular basis.
|
|
|
|
|
#
|
|
|
|
|
# Note that using pytest-xdist is currently not compatible
|
|
|
|
|
# with fetching datasets in tests due to datasets cache corruptions issues.
|
|
|
|
|
export SKLEARN_SKIP_NETWORK_TESTS=0
|
|
|
|
|
fi
|
2016-08-30 10:59:57 +08:00
|
|
|
|
|
|
|
|
if [[ "$COVERAGE" == "true" ]]; then
|
2017-11-17 03:20:35 +08:00
|
|
|
TEST_CMD="$TEST_CMD --cov sklearn"
|
2016-08-30 10:59:57 +08:00
|
|
|
fi
|
2018-09-17 18:12:33 +08:00
|
|
|
|
|
|
|
|
if [[ -n "$CHECK_WARNINGS" ]]; then
|
|
|
|
|
TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
set -x # print executed commands to the terminal
|
|
|
|
|
|
2017-02-20 20:08:09 +08:00
|
|
|
$TEST_CMD sklearn
|
2016-08-30 10:59:57 +08:00
|
|
|
}
|
|
|
|
|
|
2018-11-19 11:00:55 +08:00
|
|
|
run_tests
|