Skip to content

Commit be383f7

Browse files
committed
parallelize tests, fix paths, etc
1 parent 132b8f1 commit be383f7

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

.circle/codecov.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,23 @@ set -e # Exit immediately if a command exits with a non-zero status.
99
set -u # Treat unset variables as an error when substituting.
1010
set -x # Print command traces before executing command.
1111

12-
mkdir -p ${CIRCLE_TEST_REPORTS}/unittests ${CIRCLE_TEST_REPORTS}/smoketest
13-
cp ${SCRATCH}/coverage*.xml ${CIRCLE_TEST_REPORTS}/unittests/
14-
cp ${SCRATCH}/smoketests*.xml ${CIRCLE_TEST_REPORTS}/smoketest/
12+
# Place py.test reports in folders
13+
for f in $( find $SCRATCH/ -name "pytest*.xml" ); do
14+
folder=$( basename ${f:: -4} )
15+
mkdir -p ${CIRCLE_TEST_REPORTS}/$folder
16+
cp $f ${CIRCLE_TEST_REPORTS}/$folder/pytest.xml
17+
done
1518

1619
# Send coverage data to codecov.io
1720
curl -so codecov.io https://codecov.io/bash
1821
chmod 755 codecov.io
1922

20-
find "${CIRCLE_TEST_REPORTS}/unittests" -name '*.xml' -print0 | \
23+
find "${SCRATCH}/" -name 'coverage*.xml' -maxdepth 1 -print0 | \
2124
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F unittests
22-
find "${CIRCLE_TEST_REPORTS}/smoketest" -name '*.xml' -print0 | \
25+
find "${SCRATCH}/" -name 'smoketest*.xml' -maxdepth 1 -print0 | \
2326
xargs -0 -I file ./codecov.io -f file -t "${CODECOV_TOKEN}" -F smoketests
27+
28+
# Place coverage in the correct folders
29+
mkdir -p ${CIRCLE_TEST_REPORTS}/unittests ${CIRCLE_TEST_REPORTS}/smoketest
30+
cp ${SCRATCH}/coverage*.xml ${CIRCLE_TEST_REPORTS}/unittests/ || true
31+
cp ${SCRATCH}/smoketest*.xml ${CIRCLE_TEST_REPORTS}/smoketest/ || true

docker/files/run_examples.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ echo 'log_directory = /scratch/logs/' >> /root/.nipype/nipype.cfg
1414
coverage run /root/src/nipype/tools/run_examples.py $@
1515
arr=$@
1616
tmp_var=$( IFS=$' '; echo "${arr[*]}" )
17-
coverage xml -o "/scratch/smoketest_${tmp_var//[^A-Za-z0-9_-]/_}.xml"
17+
coverage xml -o "/scratch/smoketest_${tmp_var//[^A-Za-z0-9_-]/_}.xml"

docker/files/run_pytests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -u
66
PYTHON_VERSION=$( python -c "import sys; print('{}{}'.format(sys.version_info[0], sys.version_info[1]))" )
77

88
# Create necessary directories
9-
mkdir -p /scratch/pytest /scratch/crashfiles /scratch/logs/py${PYTHON_VERSION}
9+
mkdir -p /scratch/crashfiles /scratch/logs/py${PYTHON_VERSION}
1010

1111
# Create a nipype config file
1212
mkdir -p /root/.nipype
@@ -23,15 +23,15 @@ fi
2323
# Run tests using pytest
2424
cd /root/src/nipype/
2525
make clean
26-
py.test --doctest-modules --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}.xml --cov=nipype nipype
26+
py.test -n ${CIRCLE_NCPUS:-4} --doctest-modules --junitxml=/scratch/pytests_py{PYTHON_VERSION}.xml --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}.xml --cov=nipype nipype
2727

2828

2929
# Workaround: run here the profiler tests in python 3
3030
if [[ "${PYTHON_VERSION}" -ge "30" ]]; then
3131
echo '[execution]' >> /root/.nipype/nipype.cfg
3232
echo 'profile_runtime = true' >> /root/.nipype/nipype.cfg
33-
py.test --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}_profiler.xml --cov=nipype nipype/interfaces/tests/test_runtime_profiler.py
34-
py.test --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}_multiproc.xml --cov=nipype nipype/pipeline/plugins/tests/test_multiproc*.py
33+
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=/scratch/pytests_py{PYTHON_VERSION}_profiler.xml --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}_profiler.xml --cov=nipype nipype/interfaces/tests/test_runtime_profiler.py
34+
py.test -n ${CIRCLE_NCPUS:-4} --junitxml=/scratch/pytests_py{PYTHON_VERSION}_multiproc.xml --cov-report xml:/scratch/coverage_py${PYTHON_VERSION}_multiproc.xml --cov=nipype nipype/pipeline/plugins/tests/test_multiproc*.py
3535
fi
3636

3737
# Copy crashfiles to scratch

nipype/info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def get_nipype_gitversion():
151151
TESTS_REQUIRES = [
152152
'pytest>=%s' % PYTEST_MIN_VERSION,
153153
'pytest-cov',
154+
'pytest-xdist',
154155
'mock',
155156
'codecov',
156157
'dipy',

0 commit comments

Comments
 (0)