Skip to content

Commit 509e91f

Browse files
RomainBraultglemaitre
authored andcommitted
MAINT: move to pytest (#31)
1 parent 9913dee commit 509e91f

File tree

7 files changed

+24
-38
lines changed

7 files changed

+24
-38
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ env:
1414
- MODULE=skltemplate
1515
matrix:
1616
- DISTRIB="conda" PYTHON_VERSION="2.7"
17-
NUMPY_VERSION="1.6.2" SCIPY_VERSION="0.11.0" CYTHON_VERSION="0.21"
17+
NUMPY_VERSION="1.8.2" SCIPY_VERSION="0.13.03" CYTHON_VERSION="0.21"
1818
- DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="true"
19-
NUMPY_VERSION="1.10.4" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.23.4"
19+
NUMPY_VERSION="1.14.0" SCIPY_VERSION="1.0.0" CYTHON_VERSION="0.27.3"
2020

2121
install: source ci_scripts/travis/install.sh
2222
script: bash ci_scripts/travis/test.sh

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
[![Coveralls Status](https://coveralls.io/repos/scikit-learn-contrib/project-template/badge.svg?branch=master&service=github)](https://coveralls.io/r/scikit-learn-contrib/project-template)
55
[![CircleCI Status](https://circleci.com/gh/scikit-learn-contrib/project-template.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/scikit-learn-contrib/project-template/tree/master)
66

7-
**project-template** is a template project for
8-
[scikit-learn](http://scikit-learn.org/)
7+
**project-template** is a template project for
8+
[scikit-learn](http://scikit-learn.org/)
99
compatible extensions.
1010

1111
It aids development of estimators that can be used in scikit-learn pipelines
@@ -23,7 +23,7 @@ To install the module execute:
2323
```shell
2424
$ python setup.py install
2525
```
26-
or
26+
or
2727
```
2828
pip install sklearn-template
2929
```
@@ -38,7 +38,7 @@ you should be able to execute the following in Python:
3838

3939
`TemplateEstimator` by itself does nothing useful, but it serves as an example
4040
of how other Estimators should be written. It also comes with its own unit
41-
tests under `template/tests` which can be run using `nosetests`.
41+
tests under `skltemplate/tests` which can be run using `py.test`.
4242

4343
## Creating your own library
4444

@@ -97,7 +97,7 @@ To build the documentation locally, ensure that you have `sphinx`,
9797
$ pip install sphinx matplotlib sphinx-gallery
9898
```
9999
The documentation contains a home page (`doc/index.rst`), an API
100-
documentation page (`doc/api.rst`) and a page documenting the `template` module
100+
documentation page (`doc/api.rst`) and a page documenting the `template` module
101101
(`doc/template.rst`). Sphinx allows you to automatically document your modules
102102
and classes by using the `autodoc` directive (see `template.rst`). To change the
103103
asthetics of the docs and other paramteres, edit the `doc/conf.py` file. For
@@ -175,15 +175,15 @@ choose `Create and add user key` option. This should grant CircleCI privileges
175175
to push to the repository `https://github.com/USERNAME/DOC_REPO/`.
176176

177177
If all goes well, you should be able to visit the documentation of your project
178-
on
178+
on
179179
```
180180
https://github.com/USERNAME/DOC_REPO/DOC_URL
181181
```
182182

183183
### 8. Adding Badges
184184

185-
Follow the instructions to add a [Travis Badge](https://docs.travis-ci.com/user/status-images/),
186-
[Coveralls Badge](https://coveralls.io) and
185+
Follow the instructions to add a [Travis Badge](https://docs.travis-ci.com/user/status-images/),
186+
[Coveralls Badge](https://coveralls.io) and
187187
[CircleCI Badge](https://circleci.com/docs/status-badges) to your repository's
188188
`README`.
189189

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ install:
5252
- rmdir C:\\cygwin /s /q
5353

5454
# Install the build and runtime dependencies of the project.
55-
- conda install --quiet --yes numpy scipy cython nose scikit-learn wheel
55+
- conda install --quiet --yes numpy scipy cython nose pytest scikit-learn wheel
5656
- pip install wheelhouse_uploader nose-timer
5757
- "%CMD_IN_ENV% python setup.py bdist_wheel bdist_wininst"
5858
- ps: "ls dist"
@@ -94,4 +94,4 @@ cache:
9494
# the MKL numpy and scipy wheels mirrored on a rackspace cloud
9595
# container, speed up the appveyor jobs and reduce bandwidth
9696
# usage on our rackspace account.
97-
- '%APPDATA%\pip\Cache'
97+
- '%APPDATA%\pip\Cache'

ci_scripts/travis/install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ popd
2424

2525
# Configure the conda environment and put it in the path using the
2626
# provided versions
27-
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \
28-
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION cython=$CYTHON_VERSION
27+
conda create -n testenv --yes python=$PYTHON_VERSION \
28+
nose pip pytest pytest-cov \
29+
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION cython=$CYTHON_VERSION
2930

3031
source activate testenv
3132

ci_scripts/travis/success.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ set -e
22

33
if [[ "$COVERAGE" == "true" ]]; then
44
# Need to run coveralls from a git checkout, so we copy .coverage
5-
# from TEST_DIR where nosetests has been run
5+
# from TEST_DIR where pytest has been run
66
cp $TEST_DIR/.coverage $TRAVIS_BUILD_DIR
77
cd $TRAVIS_BUILD_DIR
88
# Ignore coveralls failures as the coveralls server is not
99
# very reliable but we don't want travis to report a failure
1010
# in the github UI just because the coverage report failed to
1111
# be published.
1212
coveralls || echo "Coveralls upload failed"
13-
fi
13+
fi

ci_scripts/travis/test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ set -e
33
# Get into a temp directory to run test from the installed scikit learn and
44
# check if we do not leave artifacts
55
mkdir -p $TEST_DIR
6-
6+
cp setup.cfg $TEST_DIR
77
cd $TEST_DIR
88

9+
TEST_CMD="pytest --showlocals --pyargs"
910
if [[ "$COVERAGE" == "true" ]]; then
10-
nosetests -s --with-coverage --cover-package=$MODULE $MODULE
11-
else
12-
nosetests -s $MODULE
11+
TEST_CMD="$TEST_CMD --cov $MODULE"
1312
fi
13+
$TEST_CMD $MODULE

setup.cfg

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,7 @@ description-file = README.md
44
[aliases]
55
# python2.7 has upgraded unittest and it is no longer compatible with some
66
# of our tests, so we run all through nose
7-
test = nosetests
7+
test = py.test
88

9-
[nosetests]
10-
# nosetests skips test files with the executable bit by default
11-
# which can silently hide failing tests.
12-
# There are no executable scripts within the scikit-learn project
13-
# so let's turn the --exe flag on to avoid skipping tests by
14-
# mistake.
15-
exe = 1
16-
cover-html = 1
17-
cover-html-dir = coverage
18-
cover-package = sklearn
19-
20-
detailed-errors = 1
21-
with-doctest = 1
22-
doctest-tests = 1
23-
doctest-extension = rst
24-
doctest-fixtures = _fixture
25-
ignore-files=^setup\.py$
9+
[tool:pytest]
10+
addopts = --doctest-modules --disable-pytest-warnings

0 commit comments

Comments
 (0)