@@ -242,6 +242,7 @@ class DerivedInterface(nib.BaseInterface):
242
242
class input_spec (nib .TraitedSpec ):
243
243
foo = nib .traits .Int (min_ver = "0.9" )
244
244
bar = nib .traits .Int (max_ver = "0.9" )
245
+
245
246
_version = "misparsed-garbage"
246
247
247
248
obj = DerivedInterface ()
@@ -252,6 +253,25 @@ class input_spec(nib.TraitedSpec):
252
253
assert len (caplog .records ) == 2
253
254
254
255
256
+ def test_input_version_missing_error ():
257
+ from nipype import config
258
+
259
+ class DerivedInterface (nib .BaseInterface ):
260
+ class input_spec (nib .TraitedSpec ):
261
+ foo = nib .traits .Int (min_ver = "0.9" )
262
+ bar = nib .traits .Int (max_ver = "0.9" )
263
+
264
+ _version = "misparsed-garbage"
265
+
266
+ with mock .patch .object (config , "getboolean" , return_value = True ):
267
+ obj = DerivedInterface (foo = 1 )
268
+ with pytest .raises (ValueError ):
269
+ obj ._check_version_requirements (obj .inputs )
270
+ obj = DerivedInterface (bar = 1 )
271
+ with pytest .raises (ValueError ):
272
+ obj ._check_version_requirements (obj .inputs )
273
+
274
+
255
275
def test_output_version ():
256
276
class InputSpec (nib .TraitedSpec ):
257
277
foo = nib .traits .Int (desc = "a random int" )
@@ -473,7 +493,7 @@ def test_global_CommandLine_output(tmpdir):
473
493
ci = BET ()
474
494
assert ci .terminal_output == "stream" # default case
475
495
476
- with mock .patch .object (nib .CommandLine , ' _terminal_output' ):
496
+ with mock .patch .object (nib .CommandLine , " _terminal_output" ):
477
497
nib .CommandLine .set_default_terminal_output ("allatonce" )
478
498
ci = nib .CommandLine (command = "ls -l" )
479
499
assert ci .terminal_output == "allatonce"
0 commit comments