Skip to content

Commit 50580aa

Browse files
committed
fix tests
1 parent 609c505 commit 50580aa

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

nipype/interfaces/base/tests/test_core.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def __init__(self):
6666

6767

6868
def test_BaseInterface():
69+
config.set('monitoring', 'enable', '0')
70+
6971
assert nib.BaseInterface.help() is None
7072
assert nib.BaseInterface._get_filecopy_info() == []
7173

@@ -82,6 +84,7 @@ class OutputSpec(nib.TraitedSpec):
8284

8385
class DerivedInterface(nib.BaseInterface):
8486
input_spec = InputSpec
87+
resource_monitor = False
8588

8689
assert DerivedInterface.help() is None
8790
assert 'moo' in ''.join(DerivedInterface._inputs_help())
@@ -252,6 +255,8 @@ class DerivedInterface1(nib.BaseInterface):
252255
input_spec = InputSpec
253256
output_spec = OutputSpec
254257
_version = '0.10'
258+
resource_monitor = False
259+
255260
obj = DerivedInterface1()
256261
assert obj._check_version_requirements(obj._outputs()) == []
257262

@@ -265,6 +270,8 @@ class DerivedInterface1(nib.BaseInterface):
265270
input_spec = InputSpec
266271
output_spec = OutputSpec
267272
_version = '0.10'
273+
resource_monitor = False
274+
268275
obj = DerivedInterface1()
269276
assert obj._check_version_requirements(obj._outputs()) == ['foo']
270277

@@ -278,6 +285,7 @@ class DerivedInterface1(nib.BaseInterface):
278285
input_spec = InputSpec
279286
output_spec = OutputSpec
280287
_version = '0.10'
288+
resource_monitor = False
281289

282290
def _run_interface(self, runtime):
283291
return runtime
@@ -298,6 +306,7 @@ def test_Commandline():
298306
ci2 = nib.CommandLine(command='which', args='ls')
299307
assert ci2.cmdline == 'which ls'
300308
ci3 = nib.CommandLine(command='echo')
309+
ci3.resource_monitor = False
301310
ci3.inputs.environ = {'MYENV': 'foo'}
302311
res = ci3.run()
303312
assert res.runtime.environ['MYENV'] == 'foo'
@@ -312,6 +321,7 @@ class CommandLineInputSpec1(nib.CommandLineInputSpec):
312321
noo = nib.traits.Int(argstr='-x %d', desc='an int')
313322
roo = nib.traits.Str(desc='not on command line')
314323
soo = nib.traits.Bool(argstr="-soo")
324+
315325
nib.CommandLine.input_spec = CommandLineInputSpec1
316326
ci4 = nib.CommandLine(command='cmd')
317327
ci4.inputs.foo = 'foo'

nipype/interfaces/base/tests/test_support.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77
from builtins import open
88
from future import standard_library
9+
from pkg_resources import resource_filename as pkgrf
910

1011
from ....utils.filemanip import md5
1112
from ... import base as nib
@@ -49,8 +50,9 @@ def test_bunch_methods():
4950
def test_bunch_hash():
5051
# NOTE: Since the path to the json file is included in the Bunch,
5152
# the hash will be unique to each machine.
52-
pth = os.path.split(os.path.abspath(__file__))[0]
53-
json_pth = os.path.join(pth, 'realign_json.json')
53+
json_pth = pkgrf(
54+
'nipype', os.path.join('testing', 'data', 'realign_json.json'))
55+
5456
b = nib.Bunch(infile=json_pth,
5557
otherthing='blue',
5658
yat=True)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ def main():
103103
pjoin('testing', 'data', 'brukerdir', 'fid'),
104104
pjoin('testing', 'data', 'brukerdir', 'pdata', '1', '*'),
105105
pjoin('testing', 'data', 'ds005', '*'),
106+
pjoin('testing', 'data', 'realign_json.json'),
106107
pjoin('workflows', 'data', '*'),
107108
pjoin('pipeline', 'engine', 'report_template.html'),
108109
pjoin('external', 'd3.js'),
109110
pjoin('interfaces', 'fsl', 'model_templates', '*'),
110-
pjoin('interfaces', 'tests', 'realign_json.json'),
111111
pjoin('interfaces', 'tests', 'use_resources'),
112112
'pytest.ini',
113113
'conftest.py',

0 commit comments

Comments
 (0)