Skip to content

Commit a30b270

Browse files
committed
fix: cleaned up nipype testing framework
1 parent 13426a0 commit a30b270

File tree

8 files changed

+29
-585
lines changed

8 files changed

+29
-585
lines changed

nipype/__init__.py

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,38 @@
1313

1414
from distutils.version import LooseVersion
1515

16-
try:
17-
from numpy.testing import nosetester
16+
from .fixes.numpy.testing import nosetester
1817

19-
class _NoseTester(nosetester.NoseTester):
20-
""" Subclass numpy's NoseTester to add doctests by default
21-
"""
18+
class _NoseTester(nosetester.NoseTester):
19+
""" Subclass numpy's NoseTester to add doctests by default
20+
"""
2221

23-
def _get_custom_doctester(self):
24-
return None
25-
26-
def prepare_test_args(self, label='fast', verbose=1, extra_argv=None,
27-
doctests=False, coverage=False):
28-
argv, plugins = super(_NoseTester, self).prepare_test_args(label=label,
29-
verbose=verbose,
30-
extra_argv=extra_argv,
31-
doctests=doctests,
32-
coverage=coverage)
33-
if doctests and '--with-numpydoctest' in argv:
34-
numpydocindex = argv.index('--with-numpydoctest')
35-
argv[numpydocindex] = '--with-doctest'
36-
return argv, plugins
37-
38-
def test(self, label='fast', verbose=1, extra_argv=['--exe'],
39-
doctests=True, coverage=False):
40-
"""Run the full test suite
41-
42-
Examples
43-
--------
44-
This will run the test suite and stop at the first failing
45-
example
46-
>>> from nipype import test
47-
>>> test(extra_argv=['--exe', '-sx']) #doctest: +SKIP
48-
"""
49-
return super(_NoseTester, self).test(label=label,
50-
verbose=verbose,
51-
extra_argv=extra_argv,
52-
doctests=doctests,
53-
coverage=coverage)
22+
def _get_custom_doctester(self):
23+
return None
5424

55-
try:
56-
test = _NoseTester(raise_warnings="release").test
57-
except TypeError:
58-
# Older versions of numpy do not have a raise_warnings argument
59-
test = _NoseTester().test
60-
del nosetester
61-
except:
62-
pass
25+
def test(self, label='fast', verbose=1, extra_argv=['--exe'],
26+
doctests=True, coverage=False):
27+
"""Run the full test suite
28+
29+
Examples
30+
--------
31+
This will run the test suite and stop at the first failing
32+
example
33+
>>> from nipype import test
34+
>>> test(extra_argv=['--exe', '-sx']) #doctest: +SKIP
35+
"""
36+
return super(_NoseTester, self).test(label=label,
37+
verbose=verbose,
38+
extra_argv=extra_argv,
39+
doctests=doctests,
40+
coverage=coverage)
41+
42+
try:
43+
test = _NoseTester(raise_warnings="release").test
44+
except TypeError:
45+
# Older versions of numpy do not have a raise_warnings argument
46+
test = _NoseTester().test
47+
del nosetester
6348

6449

6550
def _test_local_install():

nipype/testing/__init__.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212
for running the algorithms in the NIPY library. This file should
1313
import without nose being present on the python path.
1414
15-
Examples
16-
--------
17-
18-
>>> from nipy.testing import funcfile
19-
>>> from nipy.io.api import load_image
20-
>>> img = load_image(funcfile)
21-
>>> img.shape
22-
(17, 21, 3, 20)
23-
2415
"""
2516

2617
import os
@@ -37,11 +28,6 @@
3728
from nose.tools import *
3829
from numpy.testing import *
3930

40-
# Overwrites numpy.testing.Tester
41-
from .nosetester import NipyNoseTester as Tester
42-
test = Tester().test
43-
bench = Tester().bench
44-
4531
from . import decorators as dec
4632
from .utils import skip_if_no_package, package_check
4733

@@ -58,10 +44,3 @@ def example_data(infile='functional.nii'):
5844
raise IOError('%s empty data file does NOT exist'%(outfile))
5945

6046
return outfile
61-
62-
# Allow failed import of nose if not now running tests
63-
try:
64-
from nose.tools import assert_true, assert_false
65-
from lightunit import ParametricTestCase, parametric
66-
except ImportError:
67-
pass

nipype/testing/_paramtestpy2.py

Lines changed: 0 additions & 91 deletions
This file was deleted.

nipype/testing/_paramtestpy3.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)