Skip to content

Commit daba01c

Browse files
committed
enh: updated dependencies and tests for nipype
1 parent 6570949 commit daba01c

File tree

6 files changed

+30
-44
lines changed

6 files changed

+30
-44
lines changed

nipype/__init__.py

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .utils.config import NipypeConfig
1414
from .utils.logger import Logging
1515
from .refs import due
16+
from .pkg_info import get_pkg_info as _get_pkg_info
1617

1718
try:
1819
import faulthandler
@@ -23,49 +24,27 @@
2324
config = NipypeConfig()
2425
logging = Logging(config)
2526

26-
#NOTE_dj: it has to be changed to python
27-
#class _NoseTester(nosetester.NoseTester):
28-
# """ Subclass numpy's NoseTester to add doctests by default
29-
# """
30-
31-
# def _get_custom_doctester(self):
32-
# return None
3327

34-
# def test(self, label='fast', verbose=1, extra_argv=['--exe'],
35-
# doctests=True, coverage=False):
36-
# """Run the full test suite
37-
#
38-
# Examples
39-
# --------
40-
# This will run the test suite and stop at the first failing
41-
# example
42-
# >>> from nipype import test
43-
# >>> test(extra_argv=['--exe', '-sx']) # doctest: +SKIP
44-
# """
45-
# return super(_NoseTester, self).test(label=label,
46-
# verbose=verbose,
47-
# extra_argv=extra_argv,
48-
# doctests=doctests,
49-
# coverage=coverage)
28+
class NipypeTester(object):
29+
def __call__(self, doctests=True):
30+
try:
31+
import pytest
32+
except:
33+
raise RuntimeError('py.test not installed, run: pip install pytest')
34+
params = {'args': []}
35+
if doctests:
36+
params['args'].append('--doctest-modules')
37+
nipype_path = os.path.dirname(__file__)
38+
params['args'].extend(['-x', '--ignore={}/external'.format(nipype_path),
39+
nipype_path])
40+
pytest.main(**params)
5041

51-
#try:
52-
# test = _NoseTester(raise_warnings="release").test
53-
#except TypeError:
54-
# Older versions of numpy do not have a raise_warnings argument
55-
# test = _NoseTester().test
56-
#del nosetester
57-
58-
# Set up package information function
59-
from .pkg_info import get_pkg_info as _get_pkg_info
60-
get_info = lambda: _get_pkg_info(os.path.dirname(__file__))
42+
test = NipypeTester()
6143

62-
# If this file is exec after being imported, the following lines will
63-
# fail
64-
#try:
65-
# del Tester
66-
#except:
67-
# pass
6844

45+
def get_info():
46+
"""Returns package information"""
47+
return _get_pkg_info(os.path.dirname(__file__))
6948

7049
from .pipeline import Node, MapNode, JoinNode, Workflow
7150
from .interfaces import (DataGrabber, DataSink, SelectFiles,

nipype/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ def get_nipype_gitversion():
146146
'xvfbwrapper',
147147
'funcsigs',
148148
'configparser',
149+
'pytest>=%s' % PYTEST_MIN_VERSION
149150
]
150151

151152
TESTS_REQUIRES = [
152153
'pytest>=%s' % PYTEST_MIN_VERSION,
153-
'pytest-raisesregexp',
154154
'pytest-cov',
155155
'mock',
156156
'codecov',

nipype/tests/__init__.py

Whitespace-only changes.

nipype/tests/test_nipype.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from .. import get_info
2+
3+
def test_nipype_info():
4+
exception_not_raised = True
5+
try:
6+
get_info()
7+
except Exception as e:
8+
exception_not_raised = False
9+
assert exception_not_raised

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ networkx>=1.7
44
traits>=4.3
55
python-dateutil>=1.5
66
nibabel>=2.0.1
7-
future==0.15.2
7+
future>=0.15.2
88
simplejson>=3.8.0
99
prov>=1.4.0
1010
click>=6.6.0
@@ -13,5 +13,4 @@ psutil
1313
funcsigs
1414
configparser
1515
pytest>=3.0
16-
pytest-raisesregexp
1716
pytest-cov

rtd_requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ traits>=4.3
55
python-dateutil>=1.5
66
nibabel>=2.0.1
77
pytest>=3.0
8-
pytest-raisesregexp
98
pytest-cov
10-
future==0.15.2
9+
future>=0.15.2
1110
simplejson>=3.8.0
1211
prov>=1.4.0
1312
xvfbwrapper

0 commit comments

Comments
 (0)