8000 [doc build] Remove nose from CIs and documentation · scikit-learn/scikit-learn@8430f32 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8430f32

Browse files
committed
[doc build] Remove nose from CIs and documentation
1 parent b9c79d4 commit 8430f32

20 files changed

+42
-155
lines changed

.travis.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,9 @@ matrix:
3636
NUMPY_VERSION="1.8.2" SCIPY_VERSION="0.13.3" CYTHON_VERSION="0.23.5"
3737
COVERAGE=true
3838
# This environment tests the newest supported Anaconda release (4.4.0)
39-
# It also runs tests requiring Pandas.
4039
- env: DISTRIB="conda" PYTHON_VERSION="3.6.1" INSTALL_MKL="true"
41-
NUMPY_VERSION="1.13" SCIPY_VERSION="0.19.0" PANDAS_VERSION="0.20.2"
42-
CYTHON_VERSION="0.25.2" COVERAGE=true
43-
# This environment use pytest to run the tests. It uses the newest
44-
# supported Anaconda release (4.4.0). It also runs tests requiring Pandas.
45-
- env: USE_PYTEST="true" DISTRIB="conda" PYTHON_VERSION="3.6.1"
46-
INSTALL_MKL="true" NUMPY_VERSION="1.12.1" SCIPY_VERSION="0.19.0"
47-
PANDAS_VERSION="0.20.1" CYTHON_VERSION="0.25.2"
48-
TEST_DOCSTRINGS="true"
40+
NUMPY_VERSION="1.13" SCIPY_VERSION="0.19.0" CYTHON_VERSION="0.25.2"
41+
PANDAS_VERSION="0.20.2" COVERAGE=true
4942
# flake8 linting on diff wrt common ancestor with upstream/master
5043
- env: RUN_FLAKE8="true" SKIP_TESTS="true"
5144
DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="true"

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ tools:
129129
- Code with good unittest **coverage** (at least 80%), check with:
130130

131131
```bash
132-
$ pip install nose coverage
133-
$ nosetests --with-coverage path/to/tests_for_package
132+
$ pip install pytest pytest-cov
133+
$ pytest --cov sklearn path/to/tests_for_package
134134
```
135135

136136
- No pyflakes warnings, check with:

Makefile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
PYTHON ?= python
66
CYTHON ?= cython
7-
NOSETESTS ?= nosetests
7+
PYTEST ?= pytest
88
CTAGS ?= ctags
99

1010
# skip doctests on 32bit python
1111
BITS := $(shell python -c 'import struct; print(8 * struct.calcsize("P"))')
1212

1313
ifeq ($(BITS),32)
14-
NOSETESTS:=$(NOSETESTS) -c setup32.cfg
14+
PYTEST:=$(PYTEST) -c setup32.cfg
1515
endif
1616

1717

@@ -29,19 +29,17 @@ inplace:
2929
$(PYTHON) setup.py build_ext -i
3030

3131
test-code: in
32-
$(NOSETESTS) -s -v sklearn
32+
$(PYTEST) --showlocals -v sklearn
3333
test-sphinxext:
34-
$(NOSETESTS) -s -v doc/sphinxext/
34+
$(PYTEST) --showlocals -v doc/sphinxext/
3535
test-doc:
3636
ifeq ($(BITS),64)
37-
$(NOSETESTS) -s -v doc/*.rst doc/modules/ doc/datasets/ \
38-
doc/developers doc/tutorial/basic doc/tutorial/statistical_inference \
39-
doc/tutorial/text_analytics
37+
$(PYTEST) $(shell find doc -name '*.rst' | sort)
4038
endif
4139

4240
test-coverage:
4341
rm -rf coverage .coverage
44-
$(NOSETESTS) -s -v --with-coverage sklearn
42+
$(PYTEST) sklearn --show-locals -v --with-cov sklearn
4543

4644
test: test-code test-sphinxext test-doc
4745

README.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,9 @@ Testing
110110
~~~~~~~
111111

112112
After installation, you can launch the test suite from outside the
113-
source directory (you will need to have the ``nose`` package installed)::
113+
source directory (you will need to have the ``pytest`` package installed)::
114114

115-
nosetests -v sklearn
116-
117-
Under Windows, it is recommended to use the following command (adjust the path
118-
to the ``python.exe`` program) as using the ``nosetests.exe`` program can badly
119-
interact with tests that use ``multiprocessing``::
120-
121-
C:\Python34\python.exe -c "import nose; nose.main()" -v sklearn
115+
pytest sklearn
122116

123117
See the web page http://scikit-learn.org/stable/developers/advanced_installation.html#testing
124118
for more information.

appveyor.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ build: false
7878
test_script:
7979
# Change to a non-source folder to make sure we run the tests on the
8080
# installed library.
81-
- "mkdir empty_folder"
82-
- "cd empty_folder"
83-
- "python -c \"import nose; nose.main()\" --with-timer --timer-top-n 20 -s sklearn"
84-
81+
- mkdir "../empty_folder"
82+
- cd "../empty_folder"
83+
- pytest --showlocals --durations=20 --pyargs sklearn
8584
# Move back to the project folder
86-
- "cd .."
85+
- cd "../scikit-learn"
8786

8887
artifacts:
8988
# Archive the generated wheel package in the ci.appveyor.com build report.

build_tools/appveyor/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
numpy==1.9.3
1111
scipy==0.16.0
1212
cython
13-
nose
14-
nose-timer
13+
pytest
1514
wheel
1615
wheelhouse_uploader

build_tools/circle/build_doc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ conda update --yes --quiet conda
107107
# Configure the conda environment and put it in the path using the
108108
# provided versions
109109
conda create -n $CONDA_ENV_NAME --yes --quiet python numpy scipy \
110-
cython nose coverage matplotlib sphinx=1.6.2 pillow
110+
cython pytest coverage matplotlib sphinx=1.6.2 pillow
111111
source activate testenv
112112
pip install sphinx-gallery numpydoc
113113

build_tools/travis/after_success.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -e
88

99
if [[ "$COVERAGE" == "true" ]]; then
1010
# Need to run codecov from a git checkout, so we copy .coverage
11-
# from TEST_DIR where nosetests has been run
11+
# from TEST_DIR where pytest has been run
1212
cp $TEST_DIR/.coverage $TRAVIS_BUILD_DIR
1313
cd $TRAVIS_BUILD_DIR
1414
# Ignore codecov failures as the codecov server is not

build_tools/travis/install.sh

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,20 @@ if [[ "$DISTRIB" == "conda" ]]; then
3939

4040
# Configure the conda environment and put it in the path using the
4141
# provided versions
42-
if [[ "$USE_PYTEST" == "true" ]]; then
43-
TEST_RUNNER_PACKAGE=pytest
44-
else
45-
TEST_RUNNER_PACKAGE=nose
46-
fi
47-
4842
if [[ "$INSTALL_MKL" == "true" ]]; then
4943
conda create -n testenv --yes python=$PYTHON_VERSION pip \
50-
$TEST_RUNNER_PACKAGE numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
44+
pytest pytest-cov numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
5145
mkl cython=$CYTHON_VERSION \
5246
${PANDAS_VERSION+pandas=$PANDAS_VERSION}
5347

5448
else
5549
conda create -n testenv --yes python=$PYTHON_VERSION pip \
56-
$TEST_RUNNER_PACKAGE numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
50+
pytest pytest-cov numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
5751
nomkl cython=$CYTHON_VERSION \
5852
${PANDAS_VERSION+pandas=$PANDAS_VERSION}
5953
fi
6054
source activate testenv
6155

62-
if [[ $USE_PYTEST != "true" ]]; then
63-
# Install nose-timer via pip
64-
pip install nose-timer
65-
fi
66-
6756
elif [[ "$DISTRIB" == "ubuntu" ]]; then
6857
# At the time of writing numpy 1.9.1 is included in the travis
6958
# virtualenv but we want to use the numpy installed through apt-get
@@ -73,7 +62,7 @@ elif [[ "$DISTRIB" == "ubuntu" ]]; then
7362
# and scipy
7463
virtualenv --system-site-packages testvenv
7564
source testvenv/bin/activate
76-
pip install nose nose-timer cython==$CYTHON_VERSION
65+
pip install pytest pytest-cov cython==$CYTHON_VERSION
7766

7867
elif [[ "$DISTRIB" == "scipy-dev-wheels" ]]; then
7968
# Set up our own virtualenv environment to avoid travis' numpy.
@@ -86,7 +75,7 @@ elif [[ "$DISTRIB" == "scipy-dev-wheels" ]]; then
8675
echo "Installing numpy and scipy master wheels"
8776
dev_url=https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com
8877
pip install --pre --upgrade --timeout=60 -f $dev_url numpy scipy cython
89-
pip install nose nose-timer
78+
pip install pytest pytest-cov
9079
fi
9180

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

build_tools/travis/test_script.sh

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ 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 --showlocals --durations=20 --pyargs"
26-
else
27-
TEST_CMD="nosetests --with-timer --timer-top-n 20"
28-
fi
24+
TEST_CMD="pytest --showlocals --durations=20 --pyargs"
25+
2926
# Get into a temp directory to run test from the installed scikit-learn and
3027
# check if we do not leave artifacts
3128
mkdir -p $TEST_DIR
32-
# We need the setup.cfg for the nose settings
29+
# We need the setup.cfg for the pytest settings
3330
cp setup.cfg $TEST_DIR
3431
cd $TEST_DIR
3532

@@ -39,19 +36,14 @@ run_tests() {
3936
export SKLEARN_SKIP_NETWORK_TESTS=1
4037

4138
if [[ "$COVERAGE" == "true" ]]; then
42-
TEST_CMD="$TEST_CMD --with-coverage"
39+
TEST_CMD="$TEST_CMD --cov sklearn"
4340
fi
4441
$TEST_CMD sklearn
4542

4643
# Going back to git checkout folder needed to test documentation
4744
cd $OLDPWD
4845

49-
if [[ "$USE_PYTEST" == "true" ]]; then
50-
pytest $(find doc -name '*.rst' | sort)
51-
else
52-
# Makefile is using nose
53-
make test-doc
54-
fi
46+
make test-doc
5547
}
5648

5749
if [[ "$RUN_FLAKE8" == "true" ]]; then

0 commit comments

Comments
 (0)
0