Skip to content

Commit db08c4f

Browse files
committed
updated doctests for the case vtk is not installed (typically python 3.0)
1 parent cbea5b0 commit db08c4f

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ install:
4444
# Add tvtk (PIL is required by blockcanvas)
4545
# Install mayavi (see https://github.com/enthought/mayavi/issues/271)
4646
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then
47-
pip install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
48-
pip install -e git+https://github.com/enthought/etsdevtools.git#egg=etsdevtools
49-
pip install -e git+https://github.com/enthought/blockcanvas.git#egg=blockcanvas
50-
pip install -e git+https://github.com/enthought/etsproxy.git#egg=etsproxy
51-
pip install https://github.com/dmsurti/mayavi/archive/4d4aaf315a29d6a86707dd95149e27d9ed2225bf.zip
52-
pip install -e git+https://github.com/enthought/ets.git#egg=ets
47+
pip install http://effbot.org/downloads/Imaging-1.1.7.tar.gz;
48+
pip install -e git+https://github.com/enthought/etsdevtools.git#egg=etsdevtools;
49+
pip install -e git+https://github.com/enthought/blockcanvas.git#egg=blockcanvas;
50+
pip install -e git+https://github.com/enthought/etsproxy.git#egg=etsproxy;
51+
pip install https://github.com/dmsurti/mayavi/archive/4d4aaf315a29d6a86707dd95149e27d9ed2225bf.zip;
52+
pip install -e git+https://github.com/enthought/ets.git#egg=ets;
5353
fi
5454
- pip install -r requirements.txt # finish remaining requirements
5555
- python setup.py install

nipype/algorithms/mesh.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,18 @@ class ComputeMeshWarp(TVTKBaseInterface):
224224
Example
225225
-------
226226
227+
>>> from nipype.algorithms.mesh import have_tvtk
227228
>>> import nipype.algorithms.mesh as m
228-
>>> dist = m.ComputeMeshWarp()
229-
>>> dist.inputs.surface1 = 'surf1.vtk'
230-
>>> dist.inputs.surface2 = 'surf2.vtk'
231-
>>> res = dist.run() # doctest: +SKIP
229+
>>> if not have_tvtk:
230+
... dist = m.ComputeMeshWarp()
231+
Traceback (most recent call last):
232+
...
233+
ImportError: This interface requires tvtk to run.
234+
>>> else:
235+
... dist = m.ComputeMeshWarp()
236+
... dist.inputs.surface1 = 'surf1.vtk'
237+
... dist.inputs.surface2 = 'surf2.vtk'
238+
... res = dist.run() # doctest: +SKIP
232239
233240
"""
234241

@@ -355,12 +362,19 @@ class MeshWarpMaths(TVTKBaseInterface):
355362
Example
356363
-------
357364
365+
>>> from nipype.algorithms.mesh import have_tvtk
358366
>>> import nipype.algorithms.mesh as m
359-
>>> mmath = m.MeshWarpMaths()
360-
>>> mmath.inputs.in_surf = 'surf1.vtk'
361-
>>> mmath.inputs.operator = 'surf2.vtk'
362-
>>> mmath.inputs.operation = 'mul'
363-
>>> res = mmath.run() # doctest: +SKIP
367+
>>> if not have_tvtk:
368+
... mmath = m.MeshWarpMaths()
369+
Traceback (most recent call last):
370+
...
371+
ImportError: This interface requires tvtk to run.
372+
>>> else:
373+
... mmath = m.MeshWarpMaths()
374+
... mmath.inputs.in_surf = 'surf1.vtk'
375+
... mmath.inputs.operator = 'surf2.vtk'
376+
... mmath.inputs.operation = 'mul'
377+
... res = mmath.run() # doctest: +SKIP
364378
365379
"""
366380

0 commit comments

Comments
 (0)