Skip to content

[FIX] Minor errors after migration to setuptools #1671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# rsync -e ssh nipype-0.1-py2.5.egg cburns,nipy@frs.sourceforge.net:/home/frs/project/n/ni/nipy/nipype/nipype-0.1/

PYTHON ?= python
NOSETESTS ?= nosetests
NOSETESTS=`which nosetests`

.PHONY: zipdoc sdist egg upload_to_pypi trailing-spaces clean-pyc clean-so clean-build clean-ctags clean in inplace test-code test-doc test-coverage test html specs check-before-commit check

Expand Down Expand Up @@ -56,7 +56,7 @@ inplace:
$(PYTHON) setup.py build_ext -i

test-code: in
$(NOSETESTS) -s nipype --with-doctest --with-doctest-ignore-unicode
python -W once:FSL:UserWarning:nipype $(NOSETESTS) --with-doctest --with-doctest-ignore-unicode --logging-level=DEBUG --verbosity=3 nipype

test-doc:
$(NOSETESTS) -s --with-doctest --with-doctest-ignore-unicode --doctest-tests --doctest-extension=rst \
Expand All @@ -66,7 +66,8 @@ test-coverage: clean-tests in
$(NOSETESTS) -s --with-doctest --with-doctest-ignore-unicode --with-coverage --cover-package=nipype \
--config=.coveragerc

test: clean test-code
test: tests # just another name
tests: clean test-code

html:
@echo "building docs"
Expand Down
74 changes: 65 additions & 9 deletions doc/devel/testing_nipype.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _dev_testing_nipype:

==============
Testing nipype
==============
Expand All @@ -14,37 +16,91 @@ If both batteries of tests are passing, the following badges should be shown in
:target: https://circleci.com/gh/nipy/nipype/tree/master


Tests implementation
--------------------
Installation for developers
---------------------------

To check out the latest development version::

git clone https://github.com/nipy/nipype.git

After cloning::

cd nipype
pip install -r requirements.txt
python setup.py develop

or::

cd nipype
pip install -r requirements.txt
pip install -e .[tests]



Test implementation
-------------------

Nipype testing framework is built upon `nose <http://nose.readthedocs.io/en/latest/>`_.
By the time these guidelines are written, Nipype implements 17638 tests.

To run the tests locally, first get nose installed::
After installation in developer mode, the tests can be run with the
following simple command at the root folder of the project ::

make tests

pip install nose
If ``make`` is not installed in the system, it is possible to run the tests using::

python -W once:FSL:UserWarning:nipype `which nosetests` --with-doctest \
--with-doctest-ignore-unicode --logging-level=DEBUG --verbosity=3 nipype

Then, after nipype is `installed in developer mode <../users/install.html#nipype-for-developers>`_,
the tests can be run with the following simple command::

make tests
A successful test run should complete in a few minutes and end with
something like::

----------------------------------------------------------------------
Ran 17922 tests in 107.254s

OK (SKIP=27)


All tests should pass (unless you're missing a dependency). If the ``SUBJECTS_DIR```
environment variable is not set, some FreeSurfer related tests will fail.
If any of the tests failed, please report them on our `bug tracker
<http://github.com/nipy/nipype/issues>`_.

On Debian systems, set the following environment variable before running
tests::

export MATLABCMD=$pathtomatlabdir/bin/$platform/MATLAB

where ``$pathtomatlabdir`` is the path to your matlab installation and
``$platform`` is the directory referring to x86 or x64 installations
(typically ``glnxa64`` on 64-bit installations).

Skip tests
----------
~~~~~~~~~~

Nipype will skip some tests depending on the currently available software and data
dependencies. Installing software dependencies and downloading the necessary data
will reduce the number of skip tests.

Some tests in Nipype make use of some images distributed within the `FSL course data
<http://fsl.fmrib.ox.ac.uk/fslcourse/>`_. This reduced version of the package can be downloaded `here
<https://3552243d5be815c1b09152da6525cb8fe7b900a6.googledrive.com/host/0BxI12kyv2olZVUswazA3NkFvOXM/nipype-fsl_course_data.tar.gz>`_.
<https://files.osf.io/v1/resources/nefdp/providers/osfstorage/57f472cf9ad5a101f977ecfe>`_.
To enable the tests depending on these data, just unpack the targz file and set the :code:`FSL_COURSE_DATA` environment
variable to point to that folder.


Avoiding any MATLAB calls from testing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On unix systems, set an empty environment variable::

export NIPYPE_NO_MATLAB=

This will skip any tests that require matlab.


Testing Nipype using Docker
---------------------------

Expand Down
69 changes: 11 additions & 58 deletions doc/users/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ or::
pip install nipype


If you want to install all the optional features of ``nipype``,
use the following command (only for ``nipype>=0.13``)::

pip install nipype[all]


Debian and Ubuntu
~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -73,77 +79,24 @@ If you downloaded the source distribution named something
like ``nipype-x.y.tar.gz``, then unpack the tarball, change into the
``nipype-x.y`` directory and install nipype using::

pip install -r requirements.txt
python setup.py install

**Note:** Depending on permissions you may need to use ``sudo``.


Nipype for developers
---------------------

To check out the latest development version::

git clone git://github.com/nipy/nipype.git

or::

git clone https://github.com/nipy/nipype.git

After cloning::

pip install -r requirements.txt
python setup.py develop


Check out the list of nipype's `current dependencies <https://github.com/nipy/nipype/blob/master/requirements.txt>`_.


Testing the install
-------------------

The best way to test the install is to run the test suite. If you have
nose_ installed, then do the following::

python -c "import nipype; nipype.test()"

you can also test with nosetests::

nosetests --with-doctest <installation filepath>/nipype --exclude=external --exclude=testing

or::

nosetests --with-doctest nipype

A successful test run should complete in a few minutes and end with
something like::

Ran 13053 tests in 126.618s

OK (SKIP=66)

All tests should pass (unless you're missing a dependency). If SUBJECTS_DIR
variable is not set some FreeSurfer related tests will fail. If any tests
fail, please report them on our `bug tracker
<http://github.com/nipy/nipype/issues>`_.

On Debian systems, set the following environment variable before running
tests::

export MATLABCMD=$pathtomatlabdir/bin/$platform/MATLAB
The best way to test the install is checking nipype's version ::

where ``$pathtomatlabdir`` is the path to your matlab installation and
``$platform`` is the directory referring to x86 or x64 installations
(typically ``glnxa64`` on 64-bit installations).
python -c "import nipype; print(nipype.__version__)"

Avoiding any MATLAB calls from testing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On unix systems, set an empty environment variable::
Installation for developers
---------------------------

export NIPYPE_NO_MATLAB=
Developers should start `here <../devel/testing_nipype.html>`_.

This will skip any tests that require matlab.

Recommended Software
------------
Expand Down
3 changes: 2 additions & 1 deletion docker/nipype_test/Dockerfile_py27
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ RUN chmod +x /usr/bin/run_*
# Speed up building
RUN mkdir -p /root/src/nipype
COPY requirements.txt /root/src/nipype/requirements.txt
RUN pip install -r /root/src/nipype/requirements.txt
RUN pip install -r /root/src/nipype/requirements.txt && \
sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc

# Re-install nipype
COPY . /root/src/nipype
Expand Down
3 changes: 2 additions & 1 deletion docker/nipype_test/Dockerfile_py34
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ RUN rm -r ${FSLDIR}/bin/imglob && \
# Speed up building
RUN mkdir -p /root/src/nipype
COPY requirements.txt /root/src/nipype/requirements.txt
RUN pip install -r /root/src/nipype/requirements.txt
RUN pip install -r /root/src/nipype/requirements.txt && \
sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python3.4/site-packages/matplotlib/mpl-data/matplotlibrc

# Re-install nipype
COPY . /root/src/nipype
Expand Down
3 changes: 2 additions & 1 deletion docker/nipype_test/Dockerfile_py35
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ RUN rm -r ${FSLDIR}/bin/imglob && \
# Speed up building
RUN mkdir -p /root/src/nipype
COPY requirements.txt /root/src/nipype/requirements.txt
RUN pip install -r /root/src/nipype/requirements.txt
RUN pip install -r /root/src/nipype/requirements.txt && \
sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python3.5/site-packages/matplotlib/mpl-data/matplotlibrc

# Re-install nipype
COPY . /root/src/nipype
Expand Down
2 changes: 1 addition & 1 deletion nipype/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def get_nipype_gitversion():
]

EXTRA_REQUIRES = {
'doc': ['Sphinx>=0.3', 'matplotlib', 'pydotplus'],
'doc': ['Sphinx>=0.3', 'matplotlib', 'pydotplus', 'doctest-ignore-unicode'],
'tests': TESTS_REQUIRES,
'fmri': ['nitime', 'nilearn', 'dipy', 'nipy', 'matplotlib'],
'profiler': ['psutil'],
Expand Down
5 changes: 2 additions & 3 deletions nipype/interfaces/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
Undefined, isdefined, OutputMultiPath, runtime_profile,
InputMultiPath, BaseInterface, BaseInterfaceInputSpec)
from .io import IOBase, add_traits
from ..testing import assert_equal
from ..utils.filemanip import (filename_to_list, copyfile, split_filename)
from ..utils.misc import getsource, create_function_from_source

Expand Down Expand Up @@ -530,8 +529,8 @@ def _run_interface(self, runtime):
data1 = nb.load(self.inputs.volume1).get_data()
data2 = nb.load(self.inputs.volume2).get_data()

assert_equal(data1, data2)

if not np.all(data1 == data2):
raise RuntimeError('Input images are not exactly equal')
return runtime


Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ xvfbwrapper
psutil
funcsigs
configparser
doctest-ignore-unicode