Skip to content

Fix/misc test fixes #1757

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 39 commits into from
Dec 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d7fdb6f
fix: mapnode debug error - closes #1690
satra Nov 8, 2016
fcbf5a1
ref: change sleep poll duration back to 2 seconds
satra Nov 8, 2016
78afc2a
fix bru2 doctest error
satra Nov 8, 2016
cb365f4
Merge remote-tracking branch 'upstream/master' into fix/bunchmapnode
satra Nov 10, 2016
b47b17c
Merge remote-tracking branch 'upstream/master' into fix/bunchmapnode
satra Dec 3, 2016
75b38cb
added error condition
satra Dec 13, 2016
134a3d4
fix: resolved conflicts
satra Dec 13, 2016
bb24c59
restoring 2 tests that had only import statement, changing comments
djarecka Dec 15, 2016
9fb7730
fixing one assert in test_math
djarecka Dec 15, 2016
b261208
removing one test from interfaces/tests/test_base.py; it was repeatin…
djarecka Dec 15, 2016
baa349b
restring one skipif in interfaces/tests/test_io.py
djarecka Dec 15, 2016
74bd3b8
cleaning:removing pdb
djarecka Dec 15, 2016
688774b
changing a simple assert to np.isclose in test_icc_anova
djarecka Dec 15, 2016
54f496c
adding the auto test for ACompCor
djarecka Dec 15, 2016
e988b97
changing test_auto_TCompCor.py to the output of checkspecs.py
djarecka Dec 15, 2016
547a386
removing scripts from tools directory that are not used anymore
djarecka Dec 15, 2016
ce1b3e2
removing fixes
djarecka Dec 15, 2016
c8ee538
removing coverage from travis (so the coverage is calculated from Cir…
djarecka Dec 15, 2016
623f20f
fixing the travis file
djarecka Dec 15, 2016
f353fbb
Removing nosetest from nipype/__init__.py; pytest version is missing …
djarecka Dec 15, 2016
d7c6a54
restore get_info in nipype/__init__.py
djarecka Dec 16, 2016
7d77343
removing workflows from the directories that are omitted
djarecka Dec 16, 2016
e981a53
trying to fix coverage (codecov doesnt report anything), restoring so…
djarecka Dec 16, 2016
a3cf60d
it looks like codecov works at the end, removing COVERAGE_PROCESS_STA…
djarecka Dec 16, 2016
7d529e0
changing %s to format in test_maths (in all places that the strings a…
djarecka Dec 17, 2016
45b5692
Merge remote-tracking branch 'upstream/master' into fix/bunchmapnode
satra Dec 17, 2016
1fd6b76
Merge remote-tracking branch 'dorota/pytest_satrarev' into fix/bunchm…
satra Dec 18, 2016
3786640
removing test_BEDPOSTX.py and test_XFibres.py (auto tests wont be cre…
djarecka Dec 18, 2016
4fa120b
fix: clean up some tests and remove dependency on raises_regexp
satra Dec 18, 2016
5b0e74c
fix: addresses issue #1446 (solution from @ashgillman in #1551)
satra Dec 18, 2016
f290b7e
enh: use platform.node instead of getfqdn to improve DNS resolution t…
satra Dec 18, 2016
6570949
fix: ensure io classes derived from IOBase but not in nipype allow ap…
satra Dec 18, 2016
daba01c
enh: updated dependencies and tests for nipype
satra Dec 18, 2016
4d67bc3
Merge remote-tracking branch 'dorota/pytest_satrarev' into fix/bunchm…
satra Dec 18, 2016
fe60dfc
removed references to nose and fixed exception discrepancy between Py…
satra Dec 18, 2016
49d1a95
simplified test construct
satra Dec 18, 2016
8ada360
ensure node crashes switch back directory
satra Dec 21, 2016
2ec0b0f
change to simplify debugging
satra Dec 21, 2016
75300a5
fix: tests for mapnode crash
satra Dec 24, 2016
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
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ source = nipype
include = */nipype/*
omit =
*/nipype/external/*
*/nipype/workflows/*
*/nipype/fixes/*
*/setup.py
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@ install:
conda install -y nipype &&
rm -r /home/travis/miniconda/lib/python${TRAVIS_PYTHON_VERSION}/site-packages/nipype* &&
pip install -r requirements.txt &&
pip install -e .[$NIPYPE_EXTRAS] &&
export COVERAGE_PROCESS_START=$(pwd)/.coveragerc &&
export COVERAGE_DATA_FILE=$(pwd)/.coverage &&
echo "data_file = ${COVERAGE_DATA_FILE}" >> ${COVERAGE_PROCESS_START}; }
pip install -e .[$NIPYPE_EXTRAS]; }
- travis_retry inst
script:
- py.test --doctest-modules --cov=nipype nipype
after_success:
- bash <(curl -s https://codecov.io/bash) -t ac172a50-8e66-42e5-8822-5373fcf54686 -cF unittests
- py.test --doctest-modules nipype
deploy:
provider: pypi
user: satra
Expand Down
2 changes: 1 addition & 1 deletion doc/users/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Execution
*poll_sleep_duration*
This controls how long the job submission loop will sleep between submitting
all pending jobs and checking for job completion. To be nice to cluster
schedulers the default is set to 60 seconds.
schedulers the default is set to 2 seconds.

*xvfb_max_wait*
Maximum time (in seconds) to wait for Xvfb to start, if the _redirect_x parameter of an Interface is True.
Expand Down
58 changes: 18 additions & 40 deletions nipype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
STATUS as __status__,
__version__)
from .utils.config import NipypeConfig
from .fixes.numpy.testing import nosetester
from .utils.logger import Logging
from .refs import due
from .pkg_info import get_pkg_info as _get_pkg_info

try:
import faulthandler
Expand All @@ -25,48 +25,26 @@
logging = Logging(config)


class _NoseTester(nosetester.NoseTester):
""" Subclass numpy's NoseTester to add doctests by default
"""

def _get_custom_doctester(self):
return None

def test(self, label='fast', verbose=1, extra_argv=['--exe'],
doctests=True, coverage=False):
"""Run the full test suite
class NipypeTester(object):
def __call__(self, doctests=True):
try:
import pytest
except:
raise RuntimeError('py.test not installed, run: pip install pytest')
params = {'args': []}
if doctests:
params['args'].append('--doctest-modules')
nipype_path = os.path.dirname(__file__)
params['args'].extend(['-x', '--ignore={}/external'.format(nipype_path),
nipype_path])
pytest.main(**params)

Examples
--------
This will run the test suite and stop at the first failing
example
>>> from nipype import test
>>> test(extra_argv=['--exe', '-sx']) # doctest: +SKIP
"""
return super(_NoseTester, self).test(label=label,
verbose=verbose,
extra_argv=extra_argv,
doctests=doctests,
coverage=coverage)

try:
test = _NoseTester(raise_warnings="release").test
except TypeError:
# Older versions of numpy do not have a raise_warnings argument
test = _NoseTester().test
del nosetester
test = NipypeTester()

# Set up package information function
from .pkg_info import get_pkg_info as _get_pkg_info
get_info = lambda: _get_pkg_info(os.path.dirname(__file__))

# If this file is exec after being imported, the following lines will
# fail
try:
del Tester
except:
pass

def get_info():
"""Returns package information"""
return _get_pkg_info(os.path.dirname(__file__))

from .pipeline import Node, MapNode, JoinNode, Workflow
from .interfaces import (DataGrabber, DataSink, SelectFiles,
Expand Down
36 changes: 36 additions & 0 deletions nipype/algorithms/tests/test_auto_ACompCor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..confounds import ACompCor


def test_ACompCor_inputs():
input_map = dict(components_file=dict(usedefault=True,
),
header=dict(),
ignore_exception=dict(nohash=True,
usedefault=True,
),
mask_file=dict(),
num_components=dict(usedefault=True,
),
realigned_file=dict(mandatory=True,
),
regress_poly_degree=dict(usedefault=True,
),
use_regress_poly=dict(usedefault=True,
),
)
inputs = ACompCor.input_spec()

for key, metadata in list(input_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(inputs.traits()[key], metakey) == value


def test_ACompCor_outputs():
output_map = dict(components_file=dict(),
)
outputs = ACompCor.output_spec()

for key, metadata in list(output_map.items()):
for metakey, value in list(metadata.items()):
assert getattr(outputs.traits()[key], metakey) == value
18 changes: 16 additions & 2 deletions nipype/algorithms/tests/test_auto_TCompCor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,22 @@ def test_TCompCor_inputs():


def test_TCompCor_outputs():
output_map = dict(components_file=dict(),
high_variance_mask=dict()
output_map = dict(components_file=dict(usedefault=True,
),
header=dict(),
high_variance_mask=dict(),
ignore_exception=dict(nohash=True,
usedefault=True,
),
mask_file=dict(),
num_components=dict(usedefault=True,
),
realigned_file=dict(mandatory=True,
),
regress_poly_degree=dict(usedefault=True,
),
use_regress_poly=dict(usedefault=True,
),
)
outputs = TCompCor.output_spec()

Expand Down
4 changes: 2 additions & 2 deletions nipype/algorithms/tests/test_compcor.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ def test_compcor_bad_input_shapes(self):
for data_shape in (shape_less_than, shape_more_than):
data_file = utils.save_toy_nii(np.zeros(data_shape), 'temp.nii')
interface = CompCor(realigned_file=data_file, mask_file=self.mask_file)
with pytest.raises_regexp(ValueError, "dimensions"): interface.run()
with pytest.raises(ValueError, message="Dimension mismatch"): interface.run()

def test_tcompcor_bad_input_dim(self):
bad_dims = (2, 2, 2)
data_file = utils.save_toy_nii(np.zeros(bad_dims), 'temp.nii')
interface = TCompCor(realigned_file=data_file)
with pytest.raises_regexp(ValueError, '4-D'): interface.run()
with pytest.raises(ValueError, message='Not a 4D file'): interface.run()

def run_cc(self, ccinterface, expected_components, expected_header='CompCor'):
# run
Expand Down
2 changes: 1 addition & 1 deletion nipype/algorithms/tests/test_icc_anova.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ def test_ICC_rep_anova():
assert round(icc, 2) == 0.71
assert dfc == 3
assert dfe == 15
assert r_var / (r_var + e_var) == icc
assert np.isclose(r_var / (r_var + e_var), icc)
6 changes: 2 additions & 4 deletions nipype/algorithms/tests/test_mesh_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def test_ident_distances(tmpdir):
@pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed")
def test_trans_distances(tmpdir):
tempdir = str(tmpdir)
os.chdir(tempdir)

from ...interfaces.vtkbase import tvtk

in_surf = example_data('surf01.vtk')
Expand All @@ -57,10 +55,10 @@ def test_trans_distances(tmpdir):
dist.inputs.surface2 = warped_surf
dist.inputs.out_file = os.path.join(tempdir, 'distance.npy')
res = dist.run()
npt.assert_almost_equal(res.outputs.distance, np.linalg.norm(inc), 4)
assert np.allclose(res.outputs.distance, np.linalg.norm(inc), 4)
dist.inputs.weighting = 'area'
res = dist.run()
npt.assert_almost_equal(res.outputs.distance, np.linalg.norm(inc), 4)
assert np.allclose(res.outputs.distance, np.linalg.norm(inc), 4)


@pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed")
Expand Down
10 changes: 0 additions & 10 deletions nipype/fixes/README.txt

This file was deleted.

26 changes: 0 additions & 26 deletions nipype/fixes/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions nipype/fixes/numpy/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions nipype/fixes/numpy/testing/__init__.py

This file was deleted.

Loading