Skip to content

Commit ea6bdc3

Browse files
committed
hopefully, final fix to the circle deployment
* fixed nipypecmd tests * removed -n from py.test, which was making py.test think all tests passed (when some were failing) * fixed the coverage collection when running the examples
1 parent 00095c4 commit ea6bdc3

File tree

5 files changed

+26
-40
lines changed

5 files changed

+26
-40
lines changed

.coveragerc

-27
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,2 @@
11
[run]
22
branch = True
3-
data_file = .coverage
4-
source = .
5-
omit =
6-
nipype/external/*
7-
nipype/fixes/*
8-
tools/*
9-
doc/*
10-
*/tests/*
11-
include =
12-
tools/run_examples.py
13-
14-
[report]
15-
exclude_lines =
16-
# Have to re-enable the standard pragma
17-
pragma: no cover
18-
19-
# Don't complain about missing debug-only code:
20-
def __repr__
21-
if self\.debug
22-
23-
# Don't complain if tests don't hit defensive assertion code:
24-
raise AssertionError
25-
raise NotImplementedError
26-
27-
# Don't complain if non-runnable code isn't run:
28-
if 0:
29-
if __name__ == .__main__.:

docker/files/run_examples.sh

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@ echo "log_to_file = true" >> ${HOME}/.nipype/nipype.cfg
1717
echo "log_directory = ${WORKDIR}/logs/example_${example_id}" >> ${HOME}/.nipype/nipype.cfg
1818

1919
# Set up coverage
20-
export COVERAGE_PROCESS_START=/src/nipype/.coveragerc
21-
sed -i -E "s/(source = ).*'/\1\/src\/nipype\/nipype/" /src/nipype/.coveragerc
22-
sed -i -E "s/(data_file = ).*'/\1\/\/work\/.coverage/" /src/nipype/.coveragerc
20+
export COVERAGE_FILE=${WORKDIR}/.coverage_${example_id}
21+
#sed -i -E "s/(source = ).*'/\1\/src\/nipype\/nipype/" /src/nipype/.coveragerc
2322

2423
if [ "$2" == "MultiProc" ]; then
2524
echo "concurrency = multiprocessing" >> /src/nipype/.coveragerc
2625
fi
2726

28-
coverage run --rcfile=/src/nipype/.coveragerc /src/nipype/tools/run_examples.py $@
27+
coverage run /src/nipype/tools/run_examples.py $@
2928
exit_code=$?
3029

31-
coverage xml --rcfile=/src/nipype/.coveragerc -o ${WORKDIR}/smoketest_${example_id}.xml || true
30+
coverage xml -o ${WORKDIR}/smoketest_${example_id}.xml || true
3231

3332
exit $exit_code

docker/files/run_pytests.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set -e
33
set -x
44
set -u
55

6+
7+
TESTPATH=${1:-/src/nipype/}
68
WORKDIR=${WORK:-/work}
79
PYTHON_VERSION=$( python -c "import sys; print('{}{}'.format(sys.version_info[0], sys.version_info[1]))" )
810

@@ -22,15 +24,16 @@ if [[ "${PYTHON_VERSION}" -lt "30" ]]; then
2224
fi
2325

2426
# Run tests using pytest
25-
py.test -n ${CIRCLE_NCPUS:-1} -v --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}.xml --cov-config /src/nipype/.coveragerc --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}.xml /src/nipype/
27+
export COVERAGE_FILE=${WORKDIR}/.coverage_py${PYTHON_VERSION}
28+
py.test -v --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}.xml --cov nipype --cov-config /src/nipype/.coveragerc --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}.xml ${TESTPATH}
2629
exit_code=$?
2730

2831
# Workaround: run here the profiler tests in python 3
2932
if [[ "${PYTHON_VERSION}" -ge "30" ]]; then
3033
echo '[execution]' >> ${HOME}/.nipype/nipype.cfg
3134
echo 'profile_runtime = true' >> ${HOME}/.nipype/nipype.cfg
32-
py.test -n ${CIRCLE_NCPUS:-1} -v --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_profiler.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_profiler.xml /src/nipype/nipype/interfaces/tests/test_runtime_profiler.py && \
33-
py.test -n ${CIRCLE_NCPUS:-1} -v --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_multiproc.xml --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_multiproc.xml /src/nipype/nipype/pipeline/plugins/tests/test_multiproc*.py
35+
export COVERAGE_FILE=${WORKDIR}/.coverage_py${PYTHON_VERSION}_extra
36+
py.test -v --junitxml=${WORKDIR}/pytests_py${PYTHON_VERSION}_extra.xml --cov nipype --cov-report xml:${WORKDIR}/coverage_py${PYTHON_VERSION}_extra.xml /src/nipype/nipype/interfaces/tests/test_runtime_profiler.py /src/nipype/nipype/pipeline/plugins/tests/test_multiproc*.py
3437
exit_code=$(( $exit_code + $? ))
3538
fi
3639

nipype/info.py

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def get_nipype_gitversion():
144144
TESTS_REQUIRES = [
145145
'pytest>=%s' % PYTEST_MIN_VERSION,
146146
'pytest-cov',
147-
'pytest-xdist',
148147
'mock',
149148
'codecov',
150149
'dipy',

nipype/utils/tests/test_cmd.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from io import StringIO
1212
from ...utils import nipype_cmd
1313

14-
PY3 = sys.version_info[0] >= 3
14+
PY2 = sys.version_info[0] < 3
1515

1616
@contextmanager
1717
def capture_sys_output():
@@ -34,10 +34,17 @@ def test_main_returns_2_on_empty(self):
3434

3535
exit_exception = cm.value
3636
assert exit_exception.code == 2
37-
assert stderr.getvalue() == \
38-
"""usage: nipype_cmd [-h] module interface
37+
38+
msg = """usage: nipype_cmd [-h] module interface
39+
nipype_cmd: error: the following arguments are required: module, interface
40+
"""
41+
42+
if PY2:
43+
msg = """usage: nipype_cmd [-h] module interface
3944
nipype_cmd: error: too few arguments
4045
"""
46+
assert stderr.getvalue() == msg
47+
assert stdout.getvalue() == ''
4148

4249
def test_main_returns_0_on_help(self):
4350
with pytest.raises(SystemExit) as cm:
@@ -105,7 +112,12 @@ def test_run_4d_realign_without_arguments(self):
105112
in_file [in_file ...]
106113
tr"""
107114

108-
error_message += """
115+
if not PY2:
116+
error_message += """
117+
nipype_cmd nipype.interfaces.nipy FmriRealign4d: error: the following arguments are required: in_file, tr
118+
"""
119+
else:
120+
error_message += """
109121
nipype_cmd nipype.interfaces.nipy FmriRealign4d: error: too few arguments
110122
"""
111123

0 commit comments

Comments
 (0)