|
| 1 | +============== |
| 2 | +Testing nipype |
| 3 | +============== |
| 4 | + |
| 5 | +In order to ensure the stability of each release of Nipype, the project uses two |
| 6 | +continuous integration services: `CircleCI <https://circleci.com/gh/nipy/nipype/tree/master>`_ |
| 7 | +and `Travis CI <https://travis-ci.org/nipy/nipype>`_. |
| 8 | +If both batteries of tests are passing, the following badges should be shown in green color: |
| 9 | + |
| 10 | +.. image:: https://travis-ci.org/nipy/nipype.png?branch=master |
| 11 | + :target: https://travis-ci.org/nipy/nipype |
| 12 | + |
| 13 | +.. image:: https://circleci.com/gh/nipy/nipype/tree/master.svg?style=svg |
| 14 | + :target: https://circleci.com/gh/nipy/nipype/tree/master |
| 15 | + |
| 16 | + |
| 17 | +Tests implementation |
| 18 | +-------------------- |
| 19 | + |
| 20 | +Nipype testing framework is built upon `nose <http://nose.readthedocs.io/en/latest/>`_. |
| 21 | +By the time this guidelines are written, Nipype implements 17638 tests. |
| 22 | + |
| 23 | +To run the tests locally, first get nose installed:: |
| 24 | + |
| 25 | + pip install nose |
| 26 | + |
| 27 | + |
| 28 | +Then, the tests can be run with the following simple command:: |
| 29 | + |
| 30 | + make tests |
| 31 | + |
| 32 | + |
| 33 | +Skip tests |
| 34 | +---------- |
| 35 | + |
| 36 | +Nipype will skip some tests depending on the currently available software and data |
| 37 | +dependencies. Installing software dependencies and downloading the necessary data |
| 38 | +will reduce the number of skip tests. |
| 39 | + |
| 40 | +Some tests in Nipype make use of some images distributed within the `FSL course data |
| 41 | +<http://fsl.fmrib.ox.ac.uk/fslcourse/>`_. This reduced version of the package can be downloaded `here |
| 42 | +<https://3552243d5be815c1b09152da6525cb8fe7b900a6.googledrive.com/host/0BxI12kyv2olZVUswazA3NkFvOXM/nipype-fsl_course_data.tar.gz>`_. |
| 43 | +To enable the tests depending on these data, just unpack the targz file and set the :code:`FSL_COURSE_DATA` environment |
| 44 | +variable to point to that folder. |
| 45 | + |
| 46 | + |
| 47 | +Testing Nipype using Docker |
| 48 | +--------------------------- |
| 49 | + |
| 50 | +As of :code:`nipype-0.13`, Nipype is tested inside Docker containers. Once the developer |
| 51 | +`has installed the Docker Engine <https://docs.docker.com/engine/installation/>`_, testing |
| 52 | +Nipype is as easy as follows:: |
| 53 | + |
| 54 | + cd path/to/nipype/ |
| 55 | + docker build -f docker/nipype_test/Dockerfile_py27 -t nipype/nipype_test:py27 |
| 56 | + docker run -it --rm -v /etc/localtime:/etc/localtime:ro \ |
| 57 | + -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \ |
| 58 | + -v ~/examples:/root/examples:ro \ |
| 59 | + -v ~/scratch:/scratch \ |
| 60 | + -w /root/src/nipype \ |
| 61 | + nipype/nipype_test:py27 /usr/bin/run_nosetests.sh |
| 62 | + |
| 63 | +For running nipype in Python 3.5:: |
| 64 | + |
| 65 | + cd path/to/nipype/ |
| 66 | + docker build -f docker/nipype_test/Dockerfile_py35 -t nipype/nipype_test:py35 |
| 67 | + docker run -it --rm -v /etc/localtime:/etc/localtime:ro \ |
| 68 | + -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \ |
| 69 | + -v ~/examples:/root/examples:ro \ |
| 70 | + -v ~/scratch:/scratch \ |
| 71 | + -w /root/src/nipype \ |
| 72 | + nipype/nipype_test:py35 /usr/bin/run_nosetests.sh |
0 commit comments