diff --git a/nipype/__init__.py b/nipype/__init__.py index a15b2721bd..ad961e7df4 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -25,19 +25,19 @@ class NipypeTester(object): - def __call__(self, doctests=True): + def __call__(self, doctests=True, parallel=True): try: import pytest except: raise RuntimeError( 'py.test not installed, run: pip install pytest') - params = {'args': []} - if doctests: - params['args'].append('--doctest-modules') - nipype_path = os.path.dirname(__file__) - params['args'].extend( - ['-x', '--ignore={}/external'.format(nipype_path), nipype_path]) - pytest.main(**params) + args = [] + if not doctests: + args.extend(['-p', 'no:doctest']) + if not parallel: + args.append('-n0') + args.append(os.path.dirname(__file__)) + pytest.main(args=args) test = NipypeTester() diff --git a/nipype/algorithms/confounds.py b/nipype/algorithms/confounds.py index 8961433c14..bc1028beb2 100644 --- a/nipype/algorithms/confounds.py +++ b/nipype/algorithms/confounds.py @@ -3,13 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: ''' Algorithms to compute confounds in :abbr:`fMRI (functional MRI)` - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__)) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - ''' from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/algorithms/mesh.py b/nipype/algorithms/mesh.py index b37826530d..a0830935fe 100644 --- a/nipype/algorithms/mesh.py +++ b/nipype/algorithms/mesh.py @@ -3,14 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """ Miscellaneous algorithms for 2D contours and 3D triangularized meshes handling - - .. testsetup:: - # Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath( __file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/algorithms/metrics.py b/nipype/algorithms/metrics.py index 002b2a8216..f95e80edd0 100644 --- a/nipype/algorithms/metrics.py +++ b/nipype/algorithms/metrics.py @@ -4,13 +4,6 @@ ''' Image assessment algorithms. Typical overlap and error computation measures to evaluate results from other processing units. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - ''' from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/algorithms/misc.py b/nipype/algorithms/misc.py index 87b1fae400..7b9d055181 100644 --- a/nipype/algorithms/misc.py +++ b/nipype/algorithms/misc.py @@ -3,13 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: ''' Miscellaneous algorithms - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__)) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - ''' from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index 289ebc8388..6d272d8781 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -10,13 +10,6 @@ These functions include: * SpecifyModel: allows specification of sparse and non-sparse models - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/algorithms/rapidart.py b/nipype/algorithms/rapidart.py index ddf8de8992..c68276b828 100644 --- a/nipype/algorithms/rapidart.py +++ b/nipype/algorithms/rapidart.py @@ -11,12 +11,6 @@ * StimulusCorrelation: determines correlation between stimuli schedule and movement/intensity parameters - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/caching/memory.py b/nipype/caching/memory.py index 828feff75b..9fcf694d4b 100644 --- a/nipype/caching/memory.py +++ b/nipype/caching/memory.py @@ -2,12 +2,6 @@ """ Using nipype with persistence and lazy recomputation but without explicit name-steps pipeline: getting back scope in command-line based programming. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/conftest.py b/nipype/conftest.py index ada8e08fb9..9e646a2a4f 100644 --- a/nipype/conftest.py +++ b/nipype/conftest.py @@ -2,12 +2,20 @@ import numpy import os +DATADIR = os.path.realpath( + os.path.join(os.path.dirname(__file__), 'testing/data')) + @pytest.fixture(autouse=True) def add_np(doctest_namespace): doctest_namespace['np'] = numpy doctest_namespace['os'] = os - filepath = os.path.dirname(os.path.realpath(__file__)) - datadir = os.path.realpath(os.path.join(filepath, 'testing/data')) - doctest_namespace["datadir"] = datadir + doctest_namespace["datadir"] = DATADIR + + +@pytest.fixture(autouse=True) +def in_testing(request): + # This seems to be a reliable way to distinguish tests from doctests + if request.function is None: + os.chdir(DATADIR) diff --git a/nipype/info.py b/nipype/info.py index 7cee71d6bd..a44ed823cc 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -153,7 +153,7 @@ def get_nipype_gitversion(): if sys.version_info <= (3, 4): REQUIRES.append('configparser') -TESTS_REQUIRES = ['pytest-cov', 'codecov'] +TESTS_REQUIRES = ['pytest-cov', 'codecov', 'pytest-xdist', 'pytest-env'] EXTRA_REQUIRES = { 'doc': ['Sphinx>=1.4', 'numpydoc', 'matplotlib', 'pydotplus', 'pydot>=1.2.3'], diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index 38ddf09520..2cccdfe869 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -6,11 +6,6 @@ Examples -------- See the docstrings of the individual classes for examples. - .. testsetup:: - # Change directory to provide relative paths for doctests - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 666f4b7be1..13a065c27c 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -2,12 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """AFNI preprocessing interfaces - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/afni/svm.py b/nipype/interfaces/afni/svm.py index 2e6c53ce53..d465c1caaa 100644 --- a/nipype/interfaces/afni/svm.py +++ b/nipype/interfaces/afni/svm.py @@ -2,12 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft = python sts = 4 ts = 4 sw = 4 et: """Afni svm interfaces - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 1bd818c11d..6cc187a973 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -6,11 +6,6 @@ Examples -------- See the docstrings of the individual classes for examples. - .. testsetup:: - # Change directory to provide relative paths for doctests - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/ants/legacy.py b/nipype/interfaces/ants/legacy.py index 9ca5844426..40f2def728 100644 --- a/nipype/interfaces/ants/legacy.py +++ b/nipype/interfaces/ants/legacy.py @@ -4,12 +4,6 @@ # of the antsApplyTransform program. This implementation is here # for backwards compatibility. """ANTS Apply Transforms interface - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from builtins import range diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index bcc1d94b89..4fa9d0e12f 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -1,12 +1,6 @@ # -*- coding: utf-8 -*- """The ants module provides basic functions for interfacing with ants functions. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/ants/resampling.py b/nipype/interfaces/ants/resampling.py index a3f5723ba8..addbb7232e 100644 --- a/nipype/interfaces/ants/resampling.py +++ b/nipype/interfaces/ants/resampling.py @@ -1,11 +1,5 @@ # -*- coding: utf-8 -*- """ANTS Apply Transforms interface - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/ants/segmentation.py b/nipype/interfaces/ants/segmentation.py index b82db2e401..b3821c1425 100644 --- a/nipype/interfaces/ants/segmentation.py +++ b/nipype/interfaces/ants/segmentation.py @@ -1,12 +1,5 @@ # -*- coding: utf-8 -*- """The ants module provides basic functions for interfacing with ants functions. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/ants/utils.py b/nipype/interfaces/ants/utils.py index 43a3b4b98c..1813951175 100644 --- a/nipype/interfaces/ants/utils.py +++ b/nipype/interfaces/ants/utils.py @@ -1,11 +1,5 @@ # -*- coding: utf-8 -*- """ANTS Apply Transforms interface - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/ants/visualization.py b/nipype/interfaces/ants/visualization.py index 02e91b9321..21186931ce 100644 --- a/nipype/interfaces/ants/visualization.py +++ b/nipype/interfaces/ants/visualization.py @@ -1,10 +1,5 @@ # -*- coding: utf-8 -*- """The ants visualisation module provides basic functions based on ITK. - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/bru2nii.py b/nipype/interfaces/bru2nii.py index 550605d071..c1c1484d38 100644 --- a/nipype/interfaces/bru2nii.py +++ b/nipype/interfaces/bru2nii.py @@ -1,11 +1,5 @@ # -*- coding: utf-8 -*- """The bru2nii module provides basic functions for dicom conversion - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/c3.py b/nipype/interfaces/c3.py index f4778e7d93..115804cc3f 100644 --- a/nipype/interfaces/c3.py +++ b/nipype/interfaces/c3.py @@ -1,12 +1,6 @@ # -*- coding: utf-8 -*- """The ants module provides basic functions for interfacing with ants functions. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/camino/calib.py b/nipype/interfaces/camino/calib.py index e1a4ac32b5..1921f62651 100644 --- a/nipype/interfaces/camino/calib.py +++ b/nipype/interfaces/camino/calib.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/camino/connectivity.py b/nipype/interfaces/camino/connectivity.py index 39e13e46c1..97e400e0f5 100644 --- a/nipype/interfaces/camino/connectivity.py +++ b/nipype/interfaces/camino/connectivity.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) import os diff --git a/nipype/interfaces/camino/convert.py b/nipype/interfaces/camino/convert.py index 3091efd348..ee2ae2eb82 100644 --- a/nipype/interfaces/camino/convert.py +++ b/nipype/interfaces/camino/convert.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/camino/dti.py b/nipype/interfaces/camino/dti.py index a3b0f74c48..b32b9dc528 100644 --- a/nipype/interfaces/camino/dti.py +++ b/nipype/interfaces/camino/dti.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/camino/odf.py b/nipype/interfaces/camino/odf.py index ccc5f2e277..6fea6fdcfd 100644 --- a/nipype/interfaces/camino/odf.py +++ b/nipype/interfaces/camino/odf.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/camino/utils.py b/nipype/interfaces/camino/utils.py index 1146927dc5..57fcd58d9a 100644 --- a/nipype/interfaces/camino/utils.py +++ b/nipype/interfaces/camino/utils.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) import os diff --git a/nipype/interfaces/camino2trackvis/convert.py b/nipype/interfaces/camino2trackvis/convert.py index fd20442438..573ddffe2d 100644 --- a/nipype/interfaces/camino2trackvis/convert.py +++ b/nipype/interfaces/camino2trackvis/convert.py @@ -1,13 +1,6 @@ # -*- coding: utf-8 -*- """ Provides interfaces to various commands provided by Camino-Trackvis - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/cmtk/cmtk.py b/nipype/interfaces/cmtk/cmtk.py index c7ca43cd4e..a8352a1b40 100644 --- a/nipype/interfaces/cmtk/cmtk.py +++ b/nipype/interfaces/cmtk/cmtk.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) from builtins import range, open diff --git a/nipype/interfaces/cmtk/convert.py b/nipype/interfaces/cmtk/convert.py index fc2dd98f28..793b92bd4b 100644 --- a/nipype/interfaces/cmtk/convert.py +++ b/nipype/interfaces/cmtk/convert.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/cmtk/nx.py b/nipype/interfaces/cmtk/nx.py index 1072188cbc..7316d555b1 100644 --- a/nipype/interfaces/cmtk/nx.py +++ b/nipype/interfaces/cmtk/nx.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) from builtins import str, open, range diff --git a/nipype/interfaces/cmtk/parcellation.py b/nipype/interfaces/cmtk/parcellation.py index 272fd22df9..824d653027 100644 --- a/nipype/interfaces/cmtk/parcellation.py +++ b/nipype/interfaces/cmtk/parcellation.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) from builtins import range diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index f4e8065b36..12aeb0acd6 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -1,11 +1,5 @@ # -*- coding: utf-8 -*- """The dcm2nii module provides basic functions for dicom conversion - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/dcmstack.py b/nipype/interfaces/dcmstack.py index 80a26365f1..626cabe6cf 100644 --- a/nipype/interfaces/dcmstack.py +++ b/nipype/interfaces/dcmstack.py @@ -1,12 +1,5 @@ # -*- coding: utf-8 -*- """Provides interfaces to various commands provided by dcmstack - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/diffusion_toolkit/dti.py b/nipype/interfaces/diffusion_toolkit/dti.py index 436b8cd027..570ae55df5 100644 --- a/nipype/interfaces/diffusion_toolkit/dti.py +++ b/nipype/interfaces/diffusion_toolkit/dti.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various commands provided by diffusion toolkit - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/diffusion_toolkit/odf.py b/nipype/interfaces/diffusion_toolkit/odf.py index c289adeb01..cf4eb683a2 100644 --- a/nipype/interfaces/diffusion_toolkit/odf.py +++ b/nipype/interfaces/diffusion_toolkit/odf.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various commands provided by diffusion toolkit - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/diffusion_toolkit/postproc.py b/nipype/interfaces/diffusion_toolkit/postproc.py index 3536cc2643..20aaeea927 100644 --- a/nipype/interfaces/diffusion_toolkit/postproc.py +++ b/nipype/interfaces/diffusion_toolkit/postproc.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various commands provided by diffusion toolkit - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/dipy/anisotropic_power.py b/nipype/interfaces/dipy/anisotropic_power.py index 29b81d1ebb..5142b828ba 100644 --- a/nipype/interfaces/dipy/anisotropic_power.py +++ b/nipype/interfaces/dipy/anisotropic_power.py @@ -1,11 +1,4 @@ # -*- coding: utf-8 -*- -"""Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) -""" - from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/dipy/preprocess.py b/nipype/interfaces/dipy/preprocess.py index a5a81555b7..99b43da4c6 100644 --- a/nipype/interfaces/dipy/preprocess.py +++ b/nipype/interfaces/dipy/preprocess.py @@ -1,12 +1,4 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- -""" -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/dipy/simulate.py b/nipype/interfaces/dipy/simulate.py index 282f79519a..d6174908d9 100644 --- a/nipype/interfaces/dipy/simulate.py +++ b/nipype/interfaces/dipy/simulate.py @@ -1,10 +1,4 @@ # -*- coding: utf-8 -*- -"""Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) -""" from __future__ import (print_function, division, unicode_literals, absolute_import) from multiprocessing import (Pool, cpu_count) diff --git a/nipype/interfaces/dipy/tensors.py b/nipype/interfaces/dipy/tensors.py index ee19e6cd38..142c3b17de 100644 --- a/nipype/interfaces/dipy/tensors.py +++ b/nipype/interfaces/dipy/tensors.py @@ -1,10 +1,4 @@ # -*- coding: utf-8 -*- -"""Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/dipy/tracks.py b/nipype/interfaces/dipy/tracks.py index a129ed043d..3a500317db 100644 --- a/nipype/interfaces/dipy/tracks.py +++ b/nipype/interfaces/dipy/tracks.py @@ -1,11 +1,4 @@ # -*- coding: utf-8 -*- -""" -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/freesurfer/longitudinal.py b/nipype/interfaces/freesurfer/longitudinal.py index 72b71adfe1..82208322c6 100644 --- a/nipype/interfaces/freesurfer/longitudinal.py +++ b/nipype/interfaces/freesurfer/longitudinal.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various longitudinal commands provided by freesurfer - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/freesurfer/model.py b/nipype/interfaces/freesurfer/model.py index afd9ea50fc..1c39726e34 100644 --- a/nipype/interfaces/freesurfer/model.py +++ b/nipype/interfaces/freesurfer/model.py @@ -3,13 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """The freesurfer module provides basic functions for interfacing with freesurfer tools. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py index b2d6173099..7226230516 100644 --- a/nipype/interfaces/freesurfer/preprocess.py +++ b/nipype/interfaces/freesurfer/preprocess.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various commands provided by FreeSurfer - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/freesurfer/registration.py b/nipype/interfaces/freesurfer/registration.py index ccc03f9103..64d2a3ea0e 100644 --- a/nipype/interfaces/freesurfer/registration.py +++ b/nipype/interfaces/freesurfer/registration.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Provides interfaces to various longitudinal commands provided by freesurfer - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index 0fdfd8bfdb..d6aec7b8a7 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Interfaces to assorted Freesurfer utility programs. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/fsl/aroma.py b/nipype/interfaces/fsl/aroma.py index 97b3b17046..d7f8251bd8 100644 --- a/nipype/interfaces/fsl/aroma.py +++ b/nipype/interfaces/fsl/aroma.py @@ -3,12 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """This commandline module provides classes for interfacing with the `ICA-AROMA.py`_ command line tool. - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__)) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, diff --git a/nipype/interfaces/fsl/dti.py b/nipype/interfaces/fsl/dti.py index cf14d1072f..dab3c3ca11 100644 --- a/nipype/interfaces/fsl/dti.py +++ b/nipype/interfaces/fsl/dti.py @@ -4,13 +4,6 @@ """The fsl module provides classes for interfacing with the `FSL `_ command line tools. This was written to work with FSL version 4.1.4. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/fsl/epi.py b/nipype/interfaces/fsl/epi.py index 7cfbbac79a..e1b09230c8 100644 --- a/nipype/interfaces/fsl/epi.py +++ b/nipype/interfaces/fsl/epi.py @@ -4,13 +4,6 @@ """The fsl module provides classes for interfacing with the `FSL `_ command line tools. This was written to work with FSL version 5.0.4. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__)) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import print_function, division, unicode_literals, \ absolute_import diff --git a/nipype/interfaces/fsl/maths.py b/nipype/interfaces/fsl/maths.py index ef54b81965..c7636da785 100644 --- a/nipype/interfaces/fsl/maths.py +++ b/nipype/interfaces/fsl/maths.py @@ -2,14 +2,8 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ - The maths module provides higher-level interfaces to some of the operations - that can be performed with the fslmaths command-line program. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) +The maths module provides higher-level interfaces to some of the operations +that can be performed with the fslmaths command-line program. """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index 6b2224adb4..871fc558c9 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -4,12 +4,6 @@ """The fsl module provides classes for interfacing with the `FSL `_ command line tools. This was written to work with FSL version 4.1.4. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/fsl/possum.py b/nipype/interfaces/fsl/possum.py index 0adec72b8c..6eca7fb117 100644 --- a/nipype/interfaces/fsl/possum.py +++ b/nipype/interfaces/fsl/possum.py @@ -8,14 +8,6 @@ Please, check out the link for pertinent citations using POSSUM. .. Note:: This was written to work with FSL version 5.0.6. - - .. testsetup:: - # Change directory to provide relative paths for doctests - import os - filepath = os.path.dirname( os.path.realpath( __file__ ) ) - datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - os.chdir(datadir) - """ from .base import FSLCommand, FSLCommandInputSpec diff --git a/nipype/interfaces/fsl/preprocess.py b/nipype/interfaces/fsl/preprocess.py index ae24c9c54b..77f6c31314 100644 --- a/nipype/interfaces/fsl/preprocess.py +++ b/nipype/interfaces/fsl/preprocess.py @@ -4,12 +4,6 @@ """The fsl module provides classes for interfacing with the `FSL `_ command line tools. This was written to work with FSL version 4.1.4. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/fsl/utils.py b/nipype/interfaces/fsl/utils.py index 159e884a7c..7baec69256 100644 --- a/nipype/interfaces/fsl/utils.py +++ b/nipype/interfaces/fsl/utils.py @@ -8,13 +8,6 @@ Examples -------- See the docstrings of the individual classes for examples. - - .. testsetup:: - # Change directory to provide relative paths for doctests - import os - filepath = os.path.dirname(os.path.realpath( __file__ )) - datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index c4fdd75216..87c6ad9b2f 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -10,13 +10,6 @@ To come : XNATSink - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/meshfix.py b/nipype/interfaces/meshfix.py index 52f9e4f0bc..4b9db519a9 100644 --- a/nipype/interfaces/meshfix.py +++ b/nipype/interfaces/meshfix.py @@ -2,13 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Fixes meshes: - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/minc/minc.py b/nipype/interfaces/minc/minc.py index 4c35248132..ba2071a594 100644 --- a/nipype/interfaces/minc/minc.py +++ b/nipype/interfaces/minc/minc.py @@ -7,14 +7,6 @@ Author: Carlo Hamalainen http://carlo-hamalainen.net - - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix/convert.py b/nipype/interfaces/mrtrix/convert.py index 0f9e0f29ff..36b21ae2d7 100644 --- a/nipype/interfaces/mrtrix/convert.py +++ b/nipype/interfaces/mrtrix/convert.py @@ -1,13 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) -""" from __future__ import (print_function, division, unicode_literals, absolute_import) from io import open diff --git a/nipype/interfaces/mrtrix/preprocess.py b/nipype/interfaces/mrtrix/preprocess.py index 4de430bb58..5fc67177a1 100644 --- a/nipype/interfaces/mrtrix/preprocess.py +++ b/nipype/interfaces/mrtrix/preprocess.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix/tensors.py b/nipype/interfaces/mrtrix/tensors.py index 436dd75a6c..2ebe120aad 100644 --- a/nipype/interfaces/mrtrix/tensors.py +++ b/nipype/interfaces/mrtrix/tensors.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix/tracking.py b/nipype/interfaces/mrtrix/tracking.py index f159c1c29e..7a7ed995f0 100644 --- a/nipype/interfaces/mrtrix/tracking.py +++ b/nipype/interfaces/mrtrix/tracking.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix3/base.py b/nipype/interfaces/mrtrix3/base.py index eb4e834e70..0f80bda9c1 100644 --- a/nipype/interfaces/mrtrix3/base.py +++ b/nipype/interfaces/mrtrix3/base.py @@ -1,15 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix3/connectivity.py b/nipype/interfaces/mrtrix3/connectivity.py index d6106ed9df..67e602df84 100644 --- a/nipype/interfaces/mrtrix3/connectivity.py +++ b/nipype/interfaces/mrtrix3/connectivity.py @@ -1,15 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 740513194d..f11094a430 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -1,15 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index 833db6d01f..fcfe042284 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -1,15 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix3/tracking.py b/nipype/interfaces/mrtrix3/tracking.py index d432d4c1fb..2c2476acae 100644 --- a/nipype/interfaces/mrtrix3/tracking.py +++ b/nipype/interfaces/mrtrix3/tracking.py @@ -1,15 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 2c02de75e4..779cd829fc 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -1,15 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 67a944a550..c4920dc195 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -2,13 +2,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """ The ASL module of niftyfit, which wraps the fitting methods in NiftyFit. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from ..base import TraitedSpec, traits, CommandLineInputSpec diff --git a/nipype/interfaces/niftyfit/dwi.py b/nipype/interfaces/niftyfit/dwi.py index 7130ba48ef..f8f93c7d12 100644 --- a/nipype/interfaces/niftyfit/dwi.py +++ b/nipype/interfaces/niftyfit/dwi.py @@ -2,13 +2,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """ The dwi module of niftyfit, which wraps the fitting methods in NiftyFit. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from ..base import TraitedSpec, traits, isdefined, CommandLineInputSpec diff --git a/nipype/interfaces/niftyfit/qt1.py b/nipype/interfaces/niftyfit/qt1.py index 45f66f6a8a..ceefbae281 100644 --- a/nipype/interfaces/niftyfit/qt1.py +++ b/nipype/interfaces/niftyfit/qt1.py @@ -3,13 +3,6 @@ """ The QT1 module of niftyfit, which wraps the Multi-Echo T1 fitting methods in NiftyFit. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from ..base import TraitedSpec, File, traits, CommandLineInputSpec diff --git a/nipype/interfaces/niftyreg/reg.py b/nipype/interfaces/niftyreg/reg.py index 7096d5f5f3..f36752b872 100644 --- a/nipype/interfaces/niftyreg/reg.py +++ b/nipype/interfaces/niftyreg/reg.py @@ -6,13 +6,6 @@ `_ registration command line tools. The interfaces were written to work with niftyreg version 1.5.10 - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, diff --git a/nipype/interfaces/niftyreg/regutils.py b/nipype/interfaces/niftyreg/regutils.py index 7c3ed28eaf..e6ed97bd9a 100644 --- a/nipype/interfaces/niftyreg/regutils.py +++ b/nipype/interfaces/niftyreg/regutils.py @@ -5,13 +5,6 @@ `_ utility command line tools. The interfaces were written to work with niftyreg version 1.5.10 - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, diff --git a/nipype/interfaces/niftyseg/em.py b/nipype/interfaces/niftyseg/em.py index 47c0659b30..d378e0ad3e 100644 --- a/nipype/interfaces/niftyseg/em.py +++ b/nipype/interfaces/niftyseg/em.py @@ -9,13 +9,6 @@ Examples -------- See the docstrings of the individual classes for examples. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from ..base import (TraitedSpec, File, traits, CommandLineInputSpec, diff --git a/nipype/interfaces/niftyseg/label_fusion.py b/nipype/interfaces/niftyseg/label_fusion.py index 471458b743..1b0237d37c 100644 --- a/nipype/interfaces/niftyseg/label_fusion.py +++ b/nipype/interfaces/niftyseg/label_fusion.py @@ -3,13 +3,6 @@ """ The fusion module provides higher-level interfaces to some of the operations that can be performed with the seg_LabFusion command-line program. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from builtins import str diff --git a/nipype/interfaces/niftyseg/lesions.py b/nipype/interfaces/niftyseg/lesions.py index 028e751f2e..14d7f23c6b 100644 --- a/nipype/interfaces/niftyseg/lesions.py +++ b/nipype/interfaces/niftyseg/lesions.py @@ -9,13 +9,6 @@ Examples -------- See the docstrings of the individual classes for examples. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ import warnings diff --git a/nipype/interfaces/niftyseg/maths.py b/nipype/interfaces/niftyseg/maths.py index 46295bc6bc..d4773f86e8 100644 --- a/nipype/interfaces/niftyseg/maths.py +++ b/nipype/interfaces/niftyseg/maths.py @@ -9,13 +9,6 @@ Examples -------- See the docstrings of the individual classes for examples. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ import os diff --git a/nipype/interfaces/niftyseg/patchmatch.py b/nipype/interfaces/niftyseg/patchmatch.py index 7aa3a5ae88..5732b1ba17 100644 --- a/nipype/interfaces/niftyseg/patchmatch.py +++ b/nipype/interfaces/niftyseg/patchmatch.py @@ -3,13 +3,6 @@ """ The fusion module provides higher-level interfaces to some of the operations that can be performed with the seg_DetectLesions command-line program. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ import warnings diff --git a/nipype/interfaces/niftyseg/stats.py b/nipype/interfaces/niftyseg/stats.py index 5f57779f35..796e07410c 100644 --- a/nipype/interfaces/niftyseg/stats.py +++ b/nipype/interfaces/niftyseg/stats.py @@ -3,13 +3,6 @@ """ The stats module provides higher-level interfaces to some of the operations that can be performed with the niftyseg stats (seg_stats) command-line program. - -Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/\ -data')) - >>> os.chdir(datadir) """ from __future__ import print_function import numpy as np diff --git a/nipype/interfaces/nilearn.py b/nipype/interfaces/nilearn.py index 1d7bdff0e5..3a77af9f57 100644 --- a/nipype/interfaces/nilearn.py +++ b/nipype/interfaces/nilearn.py @@ -3,13 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: ''' Algorithms to compute statistics on :abbr:`fMRI (functional MRI)` - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__)) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - ''' from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/nipy/preprocess.py b/nipype/interfaces/nipy/preprocess.py index a3566e07a9..973344af94 100644 --- a/nipype/interfaces/nipy/preprocess.py +++ b/nipype/interfaces/nipy/preprocess.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) from builtins import open diff --git a/nipype/interfaces/nipy/utils.py b/nipype/interfaces/nipy/utils.py index 781263f317..12e593e1b1 100644 --- a/nipype/interfaces/nipy/utils.py +++ b/nipype/interfaces/nipy/utils.py @@ -1,12 +1,4 @@ # -*- coding: utf-8 -*- -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/petpvc.py b/nipype/interfaces/petpvc.py index c26dd4d588..59f87b482f 100644 --- a/nipype/interfaces/petpvc.py +++ b/nipype/interfaces/petpvc.py @@ -1,13 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/quickshear.py b/nipype/interfaces/quickshear.py index 4b0f8dd01c..b1317c3599 100644 --- a/nipype/interfaces/quickshear.py +++ b/nipype/interfaces/quickshear.py @@ -1,11 +1,5 @@ # -*- coding: utf-8 -*- """ Quickshear is a simple geometric defacing algorithm - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) """ from __future__ import unicode_literals diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py index f7df523587..c82811bc35 100644 --- a/nipype/interfaces/spm/model.py +++ b/nipype/interfaces/spm/model.py @@ -3,13 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """The spm module provides basic functions for interfacing with matlab and spm to access spm tools. - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/spm/preprocess.py b/nipype/interfaces/spm/preprocess.py index 1451a55ce4..dfcc93a0a5 100644 --- a/nipype/interfaces/spm/preprocess.py +++ b/nipype/interfaces/spm/preprocess.py @@ -2,12 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """SPM wrappers for preprocessing data - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/utility/csv.py b/nipype/interfaces/utility/csv.py index 54fbe91ba9..16c377e3b5 100644 --- a/nipype/interfaces/utility/csv.py +++ b/nipype/interfaces/utility/csv.py @@ -2,14 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """CSV Handling utilities - - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath(__file__)) - >>> datadir = os.path.realpath(os.path.join(filepath, - ... '../../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/interfaces/vista/vista.py b/nipype/interfaces/vista/vista.py index 729b36aaa0..5000036d02 100644 --- a/nipype/interfaces/vista/vista.py +++ b/nipype/interfaces/vista/vista.py @@ -1,14 +1,6 @@ # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" - Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) - >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - >>> os.chdir(datadir) - -""" from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/pipeline/engine/base.py b/nipype/pipeline/engine/base.py index 0883023f63..39bfbd7a6f 100644 --- a/nipype/pipeline/engine/base.py +++ b/nipype/pipeline/engine/base.py @@ -5,14 +5,6 @@ """Defines functionality for pipelined execution of interfaces The `EngineBase` class implements the more general view of a task. - - .. testsetup:: - # Change directory to provide relative paths for doctests - import os - filepath = os.path.dirname(os.path.realpath( __file__ )) - datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 7c3c40a3ad..eb0562ae0e 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -4,14 +4,6 @@ """Defines functionality for pipelined execution of interfaces The `Node` class provides core functionality for batch processing. - - .. testsetup:: - # Change directory to provide relative paths for doctests - import os - filepath = os.path.dirname(os.path.realpath( __file__ )) - datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index c6a9047337..8abef8bf14 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -5,14 +5,6 @@ """Defines functionality for pipelined execution of interfaces The `Workflow` class provides core functionality for batch processing. - - .. testsetup:: - # Change directory to provide relative paths for doctests - import os - filepath = os.path.dirname(os.path.realpath( __file__ )) - datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) - os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/nipype/pytest.ini b/nipype/pytest.ini index 835b6381c9..70f12b64aa 100644 --- a/nipype/pytest.ini +++ b/nipype/pytest.ini @@ -1,4 +1,6 @@ [pytest] norecursedirs = .git build dist doc nipype/external tools examples src -addopts = --doctest-modules +addopts = --doctest-modules -n auto doctest_optionflags = ALLOW_UNICODE NORMALIZE_WHITESPACE +env = + PYTHONHASHSEED=0 diff --git a/nipype/testing/fixtures.py b/nipype/testing/fixtures.py index fb2ed1327a..314363bd6d 100644 --- a/nipype/testing/fixtures.py +++ b/nipype/testing/fixtures.py @@ -103,7 +103,7 @@ def set_output_type(fsl_output_type): return prev_output_type -@pytest.fixture(params=[None] + list(Info.ftypes)) +@pytest.fixture(params=[None] + sorted(Info.ftypes)) def create_files_in_directory_plus_output_type(request, tmpdir): func_prev_type = set_output_type(request.param) origdir = tmpdir.chdir() diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 4b4942227e..15f8dc93bb 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -2,14 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Miscellaneous file manipulation functions - - .. testsetup:: - # Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath( __file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) diff --git a/requirements.txt b/requirements.txt index a5ac0a5683..934c2b42da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,8 @@ click>=6.6.0 funcsigs configparser pytest>=3.0 +pytest-xdist +pytest-env mock pydotplus pydot>=1.2.3