Skip to content

Commit 4d8fc36

Browse files
authored
Merge pull request #1833 from oesteban/fix/TestingCircle
[BUG] Fixing CircleCI tests (several issues)
2 parents 25b46b1 + 030eae1 commit 4d8fc36

File tree

9 files changed

+34
-156
lines changed

9 files changed

+34
-156
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Upcoming release 0.13
22
=====================
33

4+
* FIX: CircleCI were failing silently. Some fixes to tests (https://github.com/nipy/nipype/pull/1833)
45
* FIX: Issues in Docker image permissions, and docker documentation (https://github.com/nipy/nipype/pull/1825)
56
* ENH: Revised all Dockerfiles and automated deployment to Docker Hub
67
from CircleCI (https://github.com/nipy/nipype/pull/1815)

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
# Based on https://github.com/poldracklab/fmriprep/blob/9c92a3de9112f8ef1655b876de060a2ad336ffb0/Dockerfile
3232
#
3333
FROM ubuntu:xenial-20161213
34+
MAINTAINER The nipype developers https://github.com/nipy/nipype
35+
36+
ARG DEBIAN_FRONTEND=noninteractive
3437

3538
# Prepare environment
3639
RUN apt-get update && \
@@ -78,6 +81,7 @@ RUN echo "cHJpbnRmICJrcnp5c3p0b2YuZ29yZ29sZXdza2lAZ21haWwuY29tXG41MTcyXG4gKkN2dW
7881
# Installing Neurodebian packages (FSL, AFNI, git)
7982
RUN apt-get install -y --no-install-recommends \
8083
fsl-core=5.0.9-1~nd+1+nd16.04+1 \
84+
fsl-mni152-templates=5.0.7-2 \
8185
afni=16.2.07~dfsg.1-2~nd16.04+1
8286

8387
ENV FSLDIR=/usr/share/fsl/5.0 \
@@ -171,7 +175,7 @@ RUN conda config --add channels conda-forge --add channels intel && \
171175
chmod +x /usr/local/miniconda/bin/* && \
172176
conda config --set always_yes yes --set changeps1 no && \
173177
conda update -q conda && \
174-
chmod +x /usr/local/miniconda/bin/* && \
178+
chmod +x /usr/local/miniconda/bin/*; sync && \
175179
conda install -y mkl=2017.0.1 \
176180
numpy=1.11.2 \
177181
scipy=0.18.1 \

docker/Dockerfile_base

Lines changed: 0 additions & 127 deletions
This file was deleted.

docker/files/run_builddocs.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ set -u
66
mkdir -p /scratch/docs
77
make html 2>&1 | tee /scratch/builddocs.log
88
cp -r /root/src/nipype/doc/_build/html/* /scratch/docs/
9-
chmod 777 -R /scratch/docs
10-
chmod 777 /scratch/builddocs.log
119
cat /scratch/builddocs.log && if grep -q "ERROR" /scratch/builddocs.log; then false; else true; fi

docker/files/run_examples.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@ coverage run /root/src/nipype/tools/run_examples.py $@
1515
arr=$@
1616
tmp_var=$( IFS=$' '; echo "${arr[*]}" )
1717
coverage xml -o "/scratch/smoketest_${tmp_var//[^A-Za-z0-9_-]/_}.xml"
18-
19-
chmod 777 -R /scratch/logs

docker/files/run_pytests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ fi
3636

3737
# Copy crashfiles to scratch
3838
for i in $(find /root/src/nipype/ -name "crash-*" ); do cp $i /scratch/crashfiles/; done
39-
chmod 777 -R /scratch/*

docker/files/teardown.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ set -u
77
set -e
88

99
mkdir -p ${CIRCLE_TEST_REPORTS}/pytest
10-
sudo mv ~/scratch/*.xml ${CIRCLE_TEST_REPORTS}/pytest
10+
mv ~/scratch/*.xml ${CIRCLE_TEST_REPORTS}/pytest
1111
mkdir -p ~/docs
12-
sudo mv ~/scratch/docs/* ~/docs/
12+
mv ~/scratch/docs/* ~/docs/
1313
mkdir -p ~/logs
14-
sudo mv ~/scratch/builddocs.log ~/logs/builddocs.log
15-
sudo mv ~/scratch/logs/* ~/logs/
14+
mv ~/scratch/builddocs.log ~/logs/builddocs.log
15+
mv ~/scratch/logs/* ~/logs/

docker/files/tests.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ fi
1414
# They may need to be rebalanced in the future.
1515
case ${CIRCLE_NODE_INDEX} in
1616
0)
17-
time docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ level1
17+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ level1 && \
18+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ l2pipeline
1819
;;
1920
1)
20-
time docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_dartel Linear /root/examples/ l2pipeline
21-
time docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow3d
22-
time docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /root/src/nipype nipype/nipype_test:py35 /usr/bin/run_pytests.sh py35
23-
time docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1
21+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow3d && \
22+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow4d && \
23+
docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /root/src/nipype nipype/nipype_test:py27 /usr/bin/run_pytests.sh py27 && \
24+
docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /root/src/nipype nipype/nipype_test:py35 /usr/bin/run_pytests.sh py35 && \
25+
docker run --rm -it -v $SCRATCH:/scratch -w /root/src/nipype/doc nipype/nipype_test:py35 /usr/bin/run_builddocs.sh
2426
;;
2527
2)
26-
time docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ l2pipeline
27-
time docker run --rm -it -v $SCRATCH:/scratch -w /root/src/nipype/doc nipype/nipype_test:py35 /usr/bin/run_builddocs.sh
28-
time docker run --rm -it -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /root/src/nipype nipype/nipype_test:py27 /usr/bin/run_pytests.sh py27
29-
time docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1
28+
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py27 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1 && \
29+
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ l2pipeline
3030
;;
3131
3)
32-
time docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh test_spm Linear /root/examples/ workflow4d
33-
time docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /root/examples/ l1pipeline
34-
time docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /root/examples/ level1_workflow
32+
docker run --rm -it -e NIPYPE_NUMBER_OF_CPUS=4 -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_spm_nested MultiProc /root/examples/ level1 && \
33+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_fsl_feeds Linear /root/examples/ l1pipeline && \
34+
docker run --rm -it -v $HOME/examples:/root/examples:ro -v $SCRATCH:/scratch -w /scratch nipype/nipype_test:py35 /usr/bin/run_examples.sh fmri_fsl_reuse Linear /root/examples/ level1_workflow
3535
;;
3636
esac
3737

@@ -45,4 +45,3 @@ find "${CIRCLE_TEST_REPORTS}/pytest" -name 'coverage*.xml' -print0 | \
4545
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F unittests
4646
find "${CIRCLE_TEST_REPORTS}/pytest" -name 'smoketests*.xml' -print0 | \
4747
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F smoketests
48-

nipype/testing/fixtures.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
"""
66
Pytest fixtures used in tests.
77
"""
8+
from __future__ import print_function, division, unicode_literals, absolute_import
9+
810

911
import os
1012
import pytest
1113
import numpy as np
12-
1314
import nibabel as nb
15+
16+
from io import open
17+
from builtins import str
18+
1419
from nipype.interfaces.fsl import Info
1520
from nipype.interfaces.fsl.base import FSLCommand
1621

@@ -25,12 +30,13 @@ def analyze_pair_image_files(outdir, filelist, shape):
2530

2631

2732
def nifti_image_files(outdir, filelist, shape):
33+
if not isinstance(filelist, (list, tuple)):
34+
filelist = [filelist]
35+
2836
for f in filelist:
29-
hdr = nb.Nifti1Header()
30-
hdr.set_data_shape(shape)
3137
img = np.random.random(shape)
32-
nb.save(nb.Nifti1Image(img, np.eye(4), hdr),
33-
os.path.join(outdir, f))
38+
nb.Nifti1Image(img, np.eye(4), None).to_filename(
39+
os.path.join(outdir, f))
3440

3541

3642
@pytest.fixture()
@@ -88,7 +94,7 @@ def create_surf_file_in_directory(request, tmpdir):
8894
cwd = os.getcwd()
8995
os.chdir(outdir)
9096
surf = 'lh.a.nii'
91-
nifti_image_files(outdir, filelist=surf, shape=(1,100,1))
97+
nifti_image_files(outdir, filelist=surf, shape=(1, 100, 1))
9298

9399
def change_directory():
94100
os.chdir(cwd)

0 commit comments

Comments
 (0)