Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit abc2787

Browse files
committed
Add pytest build on Travis
and tweak pytest settings in setup.cfg
1 parent 21cfa48 commit abc2787

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ env:
3636
- DISTRIB="conda" PYTHON_VERSION="3.6" INSTALL_MKL="true"
3737
NUMPY_VERSION="1.11.2" SCIPY_VERSION="0.18.1" PANDAS_VERSION="0.19.1"
3838
CYTHON_VERSION="0.25.2"
39+
# This environment use pytest to run the tests. It uses the newest
40+
# supported anaconda env. It also runs tests requiring Pandas.
41+
- USE_PYTEST="true" DISTRIB="conda" PYTHON_VERSION="3.6" INSTALL_MKL="true"
42+
NUMPY_VERSION="1.11.2" SCIPY_VERSION="0.18.1" PANDAS_VERSION="0.19.1"
43+
CYTHON_VERSION="0.25.2"
3944
# flake8 linting on diff wrt common ancestor with upstream/master
4045
- RUN_FLAKE8="true" SKIP_TESTS="true"
4146
DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="true"

build_tools/travis/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ if [[ "$DISTRIB" == "conda" ]]; then
5151
# Configure the conda environment and put it in the path using the
5252
# provided versions
5353
if [[ "$INSTALL_MKL" == "true" ]]; then
54-
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \
54+
conda create -n testenv --yes python=$PYTHON_VERSION pip nose pytest \
5555
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
5656
mkl cython=$CYTHON_VERSION \
5757
${PANDAS_VERSION+pandas=$PANDAS_VERSION}
5858

5959
else
60-
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \
60+
conda create -n testenv --yes python=$PYTHON_VERSION pip nose pytest \
6161
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
6262
nomkl cython=$CYTHON_VERSION \
6363
${PANDAS_VERSION+pandas=$PANDAS_VERSION}

build_tools/travis/test_script.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ except ImportError:
2121
python -c "import multiprocessing as mp; print('%d CPUs' % mp.cpu_count())"
2222

2323
run_tests() {
24+
if [[ "$USE_PYTEST" == "true" ]]; then
25+
TEST_CMD="pytest --pyargs"
26+
else
27+
TEST_CMD="nosetests --with-coverage" # --with-timer --timer-top-n 20"
28+
fi
2429
# Get into a temp directory to run test from the installed scikit learn and
2530
# check if we do not leave artifacts
2631
mkdir -p $TEST_DIR
@@ -34,10 +39,9 @@ run_tests() {
3439
export SKLEARN_SKIP_NETWORK_TESTS=1
3540

3641
if [[ "$COVERAGE" == "true" ]]; then
37-
nosetests -s --with-coverage --with-timer --timer-top-n 20 sklearn
38-
else
39-
nosetests -s --with-timer --timer-top-n 20 sklearn
42+
TEST_CMD="$TEST_CMD --with-coverage"
4043
fi
44+
$TEST_CMD sklearn
4145

4246
# Test doc
4347
cd $OLDPWD

setup.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ doctest-fixtures = _fixture
2222
ignore-files=^setup\.py$
2323
#doctest-options = +ELLIPSIS,+NORMALIZE_WHITESPACE
2424

25+
[tool:pytest]
26+
# disable-pytest-warnings should be removed once we drop nose and we
27+
# replace yield test by parametrize
28+
addopts =
29+
--doctest-modules
30+
--disable-pytest-warnings
31+
2532
[wheelhouse_uploader]
2633
artifact_indexes=
2734
# OSX wheels built by travis (only for specific tags):

0 commit comments

Comments
 (0)