Skip to content

Commit 9f7e9fd

Browse files
Migrate testing framework to pytest from nosetests.
1 parent bd7bc9f commit 9f7e9fd

File tree

5 files changed

+27
-31
lines changed

5 files changed

+27
-31
lines changed

.github/workflows/tox.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install conda dependencies
4545
shell: bash -l {0}
4646
run: |
47-
export PKGS="numpy scipy coverage nose pip"
47+
export PKGS="numpy scipy pytest pytest-cov pip"
4848
if [ "$PANDAS_VERSION_STR" != "NONE" ]; then export PKGS="${PKGS} pandas${PANDAS_VERSION_STR}"; fi
4949
mamba install -y $PKGS
5050
- name: Install patsy
@@ -59,11 +59,7 @@ jobs:
5959
cd empty
6060
INSTALLDIR=$(python -c "import os; import patsy; print(os.path.dirname(patsy.__file__))")
6161
export PYTHONWARNINGS=default PATSY_FORCE_NO_WARNINGS=1
62-
# The --exe is because python sometimes marks all installed modules
63-
# as executable, so without --exe nosetests will just ignore
64-
# everything. Baffling, but so it goes.
65-
coverage run --source=$INSTALLDIR --rcfile=../.coveragerc $(which nosetests) -vvv --nocapture --exe --failure-detail --all-modules $INSTALLDIR
66-
coverage report --rcfile=../.coveragerc --show-missing
62+
pytest -vv -c ../setup.cfg --cov=$INSTALLDIR --cov-config=../.coveragerc --cov-report=term-missing --cov-report=xml $INSTALLDIR
6763
python ../tools/check-API-refs.py
6864
- name: Upload coverage to Codecov
6965
uses: codecov/codecov-action@v1.0.10

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ building design matrices. Patsy brings the convenience of [R](http://www.r-proje
3636
* six
3737
* numpy
3838
* Optional:
39-
* nose: needed to run tests
39+
* pytest/pytest-cov: needed to run tests
4040
* scipy: needed for spline-related functions like ``bs``
4141

4242
## Installation

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[bdist_wheel]
22
universal=1
3+
4+
[tool:pytest]
5+
python_files = *.py
6+
testpaths = patsy

setup.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@
2727
# need at least 1.4 for triu_indices
2828
"numpy >= 1.4",
2929
],
30-
classifiers =
31-
[ "Development Status :: 4 - Beta",
32-
"Intended Audience :: Developers",
33-
"Intended Audience :: Science/Research",
34-
"Intended Audience :: Financial and Insurance Industry",
35-
"License :: OSI Approved :: BSD License",
36-
"Programming Language :: Python :: 2",
37-
"Programming Language :: Python :: 2.7",
38-
"Programming Language :: Python :: 3",
39-
"Programming Language :: Python :: 3.4",
40-
"Programming Language :: Python :: 3.5",
41-
"Topic :: Scientific/Engineering",
42-
],
30+
extras_require={
31+
"test": ["pytest", "pytest-cov", "scipy"],
32+
},
33+
classifiers=[
34+
"Development Status :: 4 - Beta",
35+
"Intended Audience :: Developers",
36+
"Intended Audience :: Science/Research",
37+
"Intended Audience :: Financial and Insurance Industry",
38+
"License :: OSI Approved :: BSD License",
39+
"Programming Language :: Python :: 2",
40+
"Programming Language :: Python :: 2.7",
41+
"Programming Language :: Python :: 3",
42+
"Programming Language :: Python :: 3.4",
43+
"Programming Language :: Python :: 3.5",
44+
"Topic :: Scientific/Engineering",
45+
],
4346
)

tox.ini

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
envlist = py26,py27,py31,py32,py33,py27-no-pandas,py32-no-pandas
44

55
[testenv]
6-
deps=
7-
nose
8-
coverage
9-
numpy
6+
deps=.[test]
107
# Display all warnings, and error out on any warnings attributed to
11-
# code in the patsy namespace (but not ones triggered by nose, etc.):
8+
# code in the patsy namespace (but not ones triggered by pytest, etc.):
129
setenv=
1310
PYTHONWARNINGS=default
1411
PATSY_FORCE_NO_WARNINGS=1
1512
changedir={envdir}
1613
commands=
17-
pip install scipy
1814
sh -c "[ \"x$NO_PANDAS\" = xTRUE ] || pip install pandas"
19-
coverage run --rcfile={toxinidir}/.coveragerc -p {envbindir}/nosetests --all-modules patsy {posargs:}
20-
env PATSY_AVOID_OPTIONAL_DEPENDENCIES=1 coverage run --rcfile={toxinidir}/.coveragerc -p {envbindir}/nosetests --all-modules patsy {posargs:}
21-
coverage combine --rcfile={toxinidir}/.coveragerc
22-
coverage report --rcfile={toxinidir}/.coveragerc
23-
coverage html --rcfile={toxinidir}/.coveragerc -d {toxworkdir}/coverage/{envname}
15+
pytest -vv --cov=patsy --cov-config={toxinidir}/.coveragerc --cov-report=term-missing --cov-report=xml --cov-report=html:{toxworkdir}/coverage/{envname} {posargs:}
16+
env PATSY_AVOID_OPTIONAL_DEPENDENCIES=1 pytest -vv --cov=patsy --cov-config={toxinidir}/.coveragerc --cov-report=term-missing --cov-report=xml --cov-report=html:{toxworkdir}/coverage/{envname} {posargs:}
2417
python {toxinidir}/tools/check-API-refs.py
2518

2619
[testenv:py32-no-pandas]

0 commit comments

Comments
 (0)