Skip to content

Commit 8dac77c

Browse files
author
Jacob Roberts
committed
RF: Align on venv as virtual environment convention. Update makefile test target to re-use same script used in CI to orchestrate testing. Remove refererences to tox and nose
1 parent 7cfaebf commit 8dac77c

File tree

7 files changed

+34
-54
lines changed

7 files changed

+34
-54
lines changed

Makefile

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PROJECT=nibabel
88
# The Python executable to be used
99
#
1010
PYTHON ?= python
11-
NOSETESTS = $(PYTHON) $(shell which nosetests)
11+
TEST_RUNNER ?= pytest
1212

1313
#
1414
# Determine details on the Python/system
@@ -66,7 +66,6 @@ distclean: clean
6666
-o -iname '#*#' | xargs -L10 rm -f
6767
-rm -r dist
6868
-rm build-stamp
69-
-rm -r .tox
7069
# -rm tests/data/*.hdr.* tests/data/*.img.* tests/data/something.nii \
7170
# tests/data/noise* tests/data/None.nii
7271

@@ -83,22 +82,23 @@ $(WWW_DIR):
8382
# Tests
8483
#
8584

86-
test: unittest testmanual
85+
test: test-style unittest testmanual
8786

88-
89-
ut-%: build
90-
@PYTHONPATH=.:$(PYTHONPATH) $(NOSETESTS) nibabel/tests/test_$*.py
91-
92-
93-
unittest: build
94-
@PYTHONPATH=.:$(PYTHONPATH) $(NOSETESTS) nibabel --with-doctest
87+
unittest: build test-clean
88+
export CHECK_TYPE=test; ./tools/ci/check.sh
9589

9690
testmanual: build
97-
@cd doc/source && PYTHONPATH=../..:$(PYTHONPATH) $(NOSETESTS) --with-doctest --doctest-extension=.rst . dicom
91+
export CHECK_TYPE=doc; ./tools/ci/check.sh
9892

93+
coverage: unittest
9994

100-
coverage: build
101-
@PYTHONPATH=.:$(PYTHONPATH) $(NOSETESTS) --with-coverage --cover-package=nibabel
95+
.PHONY: test-style
96+
test-style:
97+
export CHECK_TYPE=style; ./tools/ci/check.sh
98+
99+
.PHONY: test-clean
100+
test-clean:
101+
rm -rf for_testing
102102

103103

104104
#
@@ -252,11 +252,13 @@ sdist-venv: clean
252252
rm -rf dist venv
253253
unset PYTHONPATH && $(PYTHON) setup.py sdist --formats=zip
254254
virtualenv --system-site-packages --python=$(PYTHON) venv
255-
. venv/bin/activate && pip install --ignore-installed nose
255+
. venv/bin/activate && pip install -r dev-requirements.txt
256256
mkdir venv/tmp
257257
cd venv/tmp && unzip ../../dist/*.zip
258258
. venv/bin/activate && cd venv/tmp/nibabel* && python setup.py install
259-
unset PYTHONPATH && . venv/bin/activate && cd venv && nosetests --with-doctest nibabel nisext
259+
unset PYTHONPATH && . \
260+
venv/bin/activate && \
261+
cd venv && $(TEST_RUNNER) --doctest-modules --doctest-plus nibabel nisext
260262

261263
source-release: distclean
262264
$(PYTHON) -m compileall .
@@ -269,17 +271,7 @@ venv-tests:
269271
make distclean
270272
- rm -rf $(VIRTUAL_ENV)/lib/python$(PYVER)/site-packages/nibabel
271273
$(PYTHON) setup.py install
272-
cd .. && nosetests $(VIRTUAL_ENV)/lib/python$(PYVER)/site-packages/nibabel
273-
274-
tox-fresh:
275-
# tox tests with fresh-installed virtualenvs. Needs network. And
276-
# pytox, obviously.
277-
tox -c tox.ini
278-
279-
tox-stale:
280-
# tox tests with MB's already-installed virtualenvs (numpy and nose
281-
# installed)
282-
tox -e python25,python26,python27,python32,np-1.2.1
274+
cd .. && $(TEST_RUNNER) $(VIRTUAL_ENV)/lib/python$(PYVER)/site-packages/nibabel
283275

284276
refresh-readme:
285277
$(PYTHON) tools/refresh_readme.py

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Requirements for running tests
22
-r requirements.txt
33
pytest
4+
pytest-doctestplus
5+
flake8

doc-requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Requirements for building docs
22
-r requirements.txt
33
sphinx<3
4-
numpydoc
4+
jinja2<3
5+
numpydoc<1.3
6+
MarkupSafe<2.1
57
texext
68
matplotlib >=1.3.1

doc/tools/build_modref_templates.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ def abort(error):
7171
print('***', source_version)
7272

7373
if source_version != installed_version:
74-
abort("Installed version does not match source version")
74+
abort(
75+
"Installed version does not match source version. "
76+
"source_version=" + str(source_version) +
77+
"installed_version=" + str(installed_version)
78+
)
7579

7680
docwriter = ApiDocWriter(package, rst_extension='.rst',
7781
other_defines=other_defines)

tools/ci/activate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
if [ -e virtenv/bin/activate ]; then
2-
source virtenv/bin/activate
3-
elif [ -e virtenv/Scripts/activate ]; then
4-
source virtenv/Scripts/activate
1+
if [ -e venv/bin/activate ]; then
2+
source venv/bin/activate
3+
elif [ -e venv/Scripts/activate ]; then
4+
source venv/Scripts/activate
55
else
66
echo Cannot activate virtual environment
7-
ls -R virtenv
7+
ls -R venv
88
false
99
fi
1010

tools/ci/create_venv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ echo SETUP_REQUIRES = $SETUP_REQUIRES
1212
set -x
1313

1414
python -m pip install --upgrade pip virtualenv
15-
virtualenv --python=python virtenv
15+
virtualenv --python=python venv
1616
source tools/ci/activate.sh
1717
python --version
1818
python -m pip install -U $SETUP_REQUIRES

tox.ini

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)