Repository: nipy/nipype

Issue:
Revert "[ENH] Fix paths for coverage in circleci"
Reverts nipy/nipype#1861


Discussion:

Resolving patch:
diff --git a/nipype/external/fsl_imglob.py b/nipype/external/fsl_imglob.py
--- a/nipype/external/fsl_imglob.py
+++ b/nipype/external/fsl_imglob.py
@@ -65,15 +65,8 @@
 #   innovation@isis.ox.ac.uk quoting reference DE/9564.
 from __future__ import print_function
 import sys
-import os
 import glob
-
-setAvailable = True
-if sys.version_info < (2, 4):
-    import sets
-    from sets import Set
-    setAvailable = False
-
+from builtins import range
 
 def usage():
     print("Usage: $0 [-extension/extensions] <list of names>")
@@ -94,45 +87,57 @@ def isImage(input, allExtensions):
 def removeImageExtension(input, allExtensions):
     return isImage(input, allExtensions)[1]
 
-if len(sys.argv) <= 1:
-    usage()
 
-deleteExtensions = True
-primaryExtensions = ['.nii.gz', '.nii', '.hdr.gz', '.hdr']
-secondaryExtensions = ['.img.gz', '.img']
-allExtensions = primaryExtensions+secondaryExtensions
-validExtensions = primaryExtensions
-startingArg = 1
+def main():
+    if len(sys.argv) <= 1:
+        usage()
+
+    if sys.version_info < (2, 4):
+        import sets
+        from sets import Set
+        setAvailable = False
+    else:
+        setAvailable = True
+
+    deleteExtensions = True
+    primaryExtensions = ['.nii.gz', '.nii', '.hdr.gz', '.hdr']
+    secondaryExtensions = ['.img.gz', '.img']
+    allExtensions = primaryExtensions+secondaryExtensions
+    validExtensions = primaryExtensions
+    startingArg = 1
+
+    if sys.argv[1] == "-extensions":
+        validExtensions = allExtensions
+        deleteExtensions = False
+        startingArg = 2
+    if sys.argv[1] == "-extension":
+        deleteExtensions = False
+        startingArg = 2
 
-if sys.argv[1] == "-extensions":
-    validExtensions = allExtensions
-    deleteExtensions = False
-    startingArg = 2
-if sys.argv[1] == "-extension":
-    deleteExtensions = False
-    startingArg = 2
+    filelist = []
+    for arg in range(startingArg, len(sys.argv)):
+        #      if isImage(sys.argv[arg],allExtensions)[0]:          #These enable a "pedantic" style mode currently not used
+        #         filelist.extend(glob.glob(sys.argv[arg]))
+        #      else:
+        #         for currentExtension in validExtensions:
+        #            filelist.extend(glob.glob(sys.argv[arg]+currentExtension))
+        for currentExtension in validExtensions:
+            filelist.extend(
+                glob.glob(removeImageExtension(sys.argv[arg], allExtensions)+currentExtension))
 
-filelist = []
-for arg in range(startingArg, len(sys.argv)):
-    #      if isImage(sys.argv[arg],allExtensions)[0]:          #These enable a "pedantic" style mode currently not used
-    #         filelist.extend(glob.glob(sys.argv[arg]))
-    #      else:
-    #         for currentExtension in validExtensions:
-    #            filelist.extend(glob.glob(sys.argv[arg]+currentExtension))
-    for currentExtension in validExtensions:
-        filelist.extend(
-            glob.glob(removeImageExtension(sys.argv[arg], allExtensions)+currentExtension))
+    if deleteExtensions:
+        for file in range(0, len(filelist)):
+            filelist[file] = removeImageExtension(filelist[file], allExtensions)
+    if setAvailable:
+        filelist = list(set(filelist))
+    else:
+        filelist = list(Set(filelist))
+    filelist.sort()
 
-if deleteExtensions:
     for file in range(0, len(filelist)):
-        filelist[file] = removeImageExtension(filelist[file], allExtensions)
-if setAvailable:
-    filelist = list(set(filelist))
-else:
-    filelist = list(Set(filelist))
-filelist.sort()
+        print(filelist[file], end=' ')
+        if file < len(filelist)-1:
+            print(" ", end=' ')
 
-for file in range(0, len(filelist)):
-    print(filelist[file], end=' ')
-    if file < len(filelist)-1:
-        print(" ", end=' ')
+if __name__ == "__main__":
+    main()
diff --git a/nipype/info.py b/nipype/info.py
--- a/nipype/info.py
+++ b/nipype/info.py
@@ -144,7 +144,6 @@ def get_nipype_gitversion():
 TESTS_REQUIRES = [
     'pytest>=%s' % PYTEST_MIN_VERSION,
     'pytest-cov',
-    'pytest-xdist',
     'mock',
     'codecov',
     'dipy',


Test patch:
diff --git a/.circle/tests.sh b/.circle/tests.sh
--- a/.circle/tests.sh
+++ b/.circle/tests.sh
@@ -17,23 +17,23 @@ fi
 # They may need to be rebalanced in the future.
 case ${CIRCLE_NODE_INDEX} in
   0)
-    docker run --rm -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /src/nipype nipype/nipype:py27 /usr/bin/run_pytests.sh py27 && \
-    docker run --rm -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /src/nipype nipype/nipype:py35 /usr/bin/run_pytests.sh py35 && \
-    docker run --rm -it -v $WORKDIR:/work -w /src/nipype/doc nipype/nipype:py35 /usr/bin/run_builddocs.sh && \
-    docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d && \
-    docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d
+    docker run --rm=false -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_pytests.sh && \
+    docker run --rm=false -it -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_pytests.sh && \
+    docker run --rm=false -it -v $WORKDIR:/work -w /src/nipype/doc nipype/nipype:py35 /usr/bin/run_builddocs.sh && \
+    docker run --rm=false -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d && \
+    docker run --rm=false -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d
     ;;
   1)
-    docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 && \
-    docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline
+    docker run --rm=false -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 && \
+    docker run --rm=false -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline
     ;;
   2)
-    docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
-    docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline
+    docker run --rm=false -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
+    docker run --rm=false -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline
     ;;
   3)
-    docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
-    docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline && \
-    docker run --rm -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow
+    docker run --rm=false -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 && \
+    docker run --rm=false -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline && \
+    docker run --rm=false -it -v $HOME/examples:/data/examples:ro -v $WORKDIR:/work -w /work nipype/nipype:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow
     ;;
 esac
diff --git a/nipype/utils/tests/test_cmd.py b/nipype/utils/tests/test_cmd.py
--- a/nipype/utils/tests/test_cmd.py
+++ b/nipype/utils/tests/test_cmd.py
@@ -11,8 +11,7 @@
 from io import StringIO
 from ...utils import nipype_cmd
 
-PY3 = sys.version_info[0] >= 3
-PY2 = sys.version_info[0] < 2
+PY2 = sys.version_info[0] < 3
 
 @contextmanager
 def capture_sys_output():
@@ -36,17 +35,15 @@ def test_main_returns_2_on_empty(self):
         exit_exception = cm.value
         assert exit_exception.code == 2
 
-        if PY2:
-            assert stderr.getvalue() == \
-                """usage: nipype_cmd [-h] module interface
-nipype_cmd: error: too few arguments
-"""
-        elif PY3:
-            assert stderr.getvalue() == \
-                """usage: nipype_cmd [-h] module interface
+        msg = """usage: nipype_cmd [-h] module interface
 nipype_cmd: error: the following arguments are required: module, interface
 """
 
+        if PY2:
+            msg = """usage: nipype_cmd [-h] module interface
+nipype_cmd: error: too few arguments
+"""
+        assert stderr.getvalue() == msg
         assert stdout.getvalue() == ''
 
     def test_main_returns_0_on_help(self):
@@ -115,7 +112,7 @@ def test_run_4d_realign_without_arguments(self):
                                                        in_file [in_file ...]
                                                        tr"""
 
-        if PY3:
+        if not PY2:
             error_message += """
 nipype_cmd nipype.interfaces.nipy FmriRealign4d: error: the following arguments are required: in_file, tr
 """