Skip to content

CI: make check-before-commit on Travis #3066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
- PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"
- EXTRA_PIP_FLAGS="--find-links=$EXTRA_WHEELS"
- CHECK_TYPE=test
matrix:
- INSTALL_DEB_DEPENDECIES=true
NIPYPE_EXTRAS="doc,tests,nipy,profiler"
Expand All @@ -31,6 +32,13 @@ env:
EXTRA_PIP_FLAGS="--pre $EXTRA_PIP_FLAGS --find-links $PRE_WHEELS"
CI_SKIP_TEST=1

matrix:
include:
- python: 3.7
env:
- NIPYPE_EXTRAS=dev
CHECK_TYPE=specs

addons:
apt:
packages:
Expand Down Expand Up @@ -64,7 +72,16 @@ install:
- travis_retry pip install pytest-xdist

script:
- py.test -v --cov nipype --cov-config .coveragerc --cov-report xml:cov.xml -c nipype/pytest.ini --doctest-modules nipype -n auto
- |
if [ "$CHECK_TYPE" = "test" ]; then
py.test -v --cov nipype --cov-config .coveragerc --cov-report xml:cov.xml -c nipype/pytest.ini --doctest-modules nipype -n auto
fi
- |
if [ "$CHECK_TYPE" = "specs" ]; then
make specs
git add nipype
test "$( git diff --cached | wc -l )" -eq 0 || ( git diff --cached && false )
fi

after_script:
- codecov --file cov.xml --flags unittests -e TRAVIS_JOB_NUMBER
1 change: 1 addition & 0 deletions nipype/interfaces/afni/tests/test_auto_Remlfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_Remlfit_inputs():
extensions=None,
),
gltsym=dict(argstr='-gltsym "%s" %s...', ),
goforit=dict(argstr='-GOFORIT', ),
in_files=dict(
argstr='-input "%s"',
copyfile=False,
Expand Down
8 changes: 4 additions & 4 deletions nipype/interfaces/afni/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +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:
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
AFNI utility interfaces.

Expand Down Expand Up @@ -213,9 +213,9 @@ class Autobox(AFNICommand):
def aggregate_outputs(self, runtime=None, needed_outputs=None):
outputs = super(Autobox, self).aggregate_outputs(
runtime, needed_outputs)
pattern = 'x=(?P<x_min>-?\d+)\.\.(?P<x_max>-?\d+) '\
'y=(?P<y_min>-?\d+)\.\.(?P<y_max>-?\d+) '\
'z=(?P<z_min>-?\d+)\.\.(?P<z_max>-?\d+)'
pattern = r'x=(?P<x_min>-?\d+)\.\.(?P<x_max>-?\d+) '\
r'y=(?P<y_min>-?\d+)\.\.(?P<y_max>-?\d+) '\
r'z=(?P<z_min>-?\d+)\.\.(?P<z_max>-?\d+)'
for line in runtime.stderr.split('\n'):
m = re.search(pattern, line)
if m:
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/diffusion_toolkit/dti.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class DTIRecon(CommandLine):
def _create_gradient_matrix(self, bvecs_file, bvals_file):
_gradient_matrix_file = 'gradient_matrix.txt'
with open(bvals_file) as fbvals:
bvals = [val for val in re.split('\s+', fbvals.readline().strip())]
bvals = [val for val in re.split(r'\s+', fbvals.readline().strip())]
with open(bvecs_file) as fbvecs:
bvecs_x = fbvecs.readline().split()
bvecs_y = fbvecs.readline().split()
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/dipy/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os.path as op
import numpy as np
import nibabel as nb
import nibabel.trackvis as nbt
from distutils.version import LooseVersion

from ... import logging
Expand Down Expand Up @@ -89,6 +88,7 @@ class TrackDensityMap(DipyBaseInterface):
def _run_interface(self, runtime):
from numpy import min_scalar_type
from dipy.tracking.utils import density_map
import nibabel.trackvis as nbt

tracks, header = nbt.read(self.inputs.in_file)
streams = ((ii[0]) for ii in tracks)
Expand Down
24 changes: 12 additions & 12 deletions nipype/interfaces/fsl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,18 +858,18 @@ def _run_interface(self, runtime):
runtime = super(AvScale, self)._run_interface(runtime)

expr = re.compile(
'Rotation\ &\ Translation\ Matrix:\n(?P<rot_tran_mat>[0-9\.\ \n-]+)[\s\n]*'
'(Rotation\ Angles\ \(x,y,z\)\ \[rads\]\ =\ (?P<rot_angles>[0-9\.\ -]+))?[\s\n]*'
'(Translations\ \(x,y,z\)\ \[mm\]\ =\ (?P<translations>[0-9\.\ -]+))?[\s\n]*'
'Scales\ \(x,y,z\)\ =\ (?P<scales>[0-9\.\ -]+)[\s\n]*'
'Skews\ \(xy,xz,yz\)\ =\ (?P<skews>[0-9\.\ -]+)[\s\n]*'
'Average\ scaling\ =\ (?P<avg_scaling>[0-9\.-]+)[\s\n]*'
'Determinant\ =\ (?P<determinant>[0-9\.-]+)[\s\n]*'
'Left-Right\ orientation:\ (?P<lr_orientation>[A-Za-z]+)[\s\n]*'
'Forward\ half\ transform\ =[\s]*\n'
'(?P<fwd_half_xfm>[0-9\.\ \n-]+)[\s\n]*'
'Backward\ half\ transform\ =[\s]*\n'
'(?P<bwd_half_xfm>[0-9\.\ \n-]+)[\s\n]*')
r'Rotation & Translation Matrix:\n(?P<rot_tran_mat>[0-9\. \n-]+)[\s\n]*'
r'(Rotation Angles \(x,y,z\) \[rads\] = (?P<rot_angles>[0-9\. -]+))?[\s\n]*'
r'(Translations \(x,y,z\) \[mm\] = (?P<translations>[0-9\. -]+))?[\s\n]*'
r'Scales \(x,y,z\) = (?P<scales>[0-9\. -]+)[\s\n]*'
r'Skews \(xy,xz,yz\) = (?P<skews>[0-9\. -]+)[\s\n]*'
r'Average scaling = (?P<avg_scaling>[0-9\.-]+)[\s\n]*'
r'Determinant = (?P<determinant>[0-9\.-]+)[\s\n]*'
r'Left-Right orientation: (?P<lr_orientation>[A-Za-z]+)[\s\n]*'
r'Forward half transform =[\s]*\n'
r'(?P<fwd_half_xfm>[0-9\. \n-]+)[\s\n]*'
r'Backward half transform =[\s]*\n'
r'(?P<bwd_half_xfm>[0-9\. \n-]+)[\s\n]*')
out = expr.search(runtime.stdout).groupdict()
outputs = {}
outputs['rotation_translation_matrix'] = [[
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class Rescale(SimpleInterface):
Examples
--------

To use a high-resolution T1w image as a registration target for a T2\*
image, it may be useful to invert the T1w image and rescale to the T2\*
To use a high-resolution T1w image as a registration target for a T2\\*
image, it may be useful to invert the T1w image and rescale to the T2\\*
range.
Using the 1st and 99th percentiles may reduce the impact of outlier
voxels.
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ class DataFinder(IOBase):
>>> from nipype.interfaces.io import DataFinder
>>> df = DataFinder()
>>> df.inputs.root_paths = '.'
>>> df.inputs.match_regex = '.+/(?P<series_dir>.+(qT1|ep2d_fid_T1).+)/(?P<basename>.+)\.nii.gz'
>>> df.inputs.match_regex = r'.+/(?P<series_dir>.+(qT1|ep2d_fid_T1).+)/(?P<basename>.+)\.nii.gz'
>>> result = df.run() # doctest: +SKIP
>>> result.outputs.out_paths # doctest: +SKIP
['./027-ep2d_fid_T1_Gd4/acquisition.nii.gz',
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def test_datafinder_unpack(tmpdir):

df = nio.DataFinder()
df.inputs.root_paths = outdir
df.inputs.match_regex = '.+/(?P<basename>.+)\.txt'
df.inputs.match_regex = r'.+/(?P<basename>.+)\.txt'
df.inputs.unpack_single = True
result = df.run()
print(result.outputs.out_paths)
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/utility/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class Rename(SimpleInterface, IOBase):

>>> rename3 = Rename(format_string="%(subject_id)s_%(seq)s_run%(run)02d.nii")
>>> rename3.inputs.in_file = os.path.join(datadir, "func_epi_1_1.nii")
>>> rename3.inputs.parse_string = "func_(?P<seq>\w*)_.*"
>>> rename3.inputs.parse_string = r"func_(?P<seq>\w*)_.*"
>>> rename3.inputs.subject_id = "subj_201"
>>> rename3.inputs.run = 2
>>> res = rename3.run() # doctest: +SKIP
Expand Down
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def save_resultfile(result, cwd, name, rebase=None):
logger.debug("Saving results file: '%s'", resultsfile)

if result.outputs is None:
logger.warn('Storing result file without outputs')
logger.warning('Storing result file without outputs')
savepkl(resultsfile, result)
return
try:
Expand Down