Skip to content

Pytest follow-up #1751

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 19 commits into from
Dec 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
3786640
removing test_BEDPOSTX.py and test_XFibres.py (auto tests wont be cre…
djarecka Dec 18, 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
63 changes: 31 additions & 32 deletions nipype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
STATUS as __status__,
__version__)
from .utils.config import NipypeConfig
from .fixes.numpy.testing import nosetester
from .utils.logger import Logging
from .refs import due

Expand All @@ -24,48 +23,48 @@
config = NipypeConfig()
logging = Logging(config)

#NOTE_dj: it has to be changed to python
#class _NoseTester(nosetester.NoseTester):
# """ Subclass numpy's NoseTester to add doctests by default
# """

class _NoseTester(nosetester.NoseTester):
""" Subclass numpy's NoseTester to add doctests by default
"""
# def _get_custom_doctester(self):
# return None

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
#
# 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)

def test(self, label='fast', verbose=1, extra_argv=['--exe'],
doctests=True, coverage=False):
"""Run the full test suite

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:
#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 = _NoseTester().test
#del nosetester

# 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
#try:
# del Tester
#except:
# pass


from .pipeline import Node, MapNode, JoinNode, Workflow
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
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer allclose for compatibility with earlier numpy versions.

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