Skip to content

Commit 8f921ba

Browse files
committed
TEST: Check RuntimeErrors raised for missing/broken runtimes
1 parent 8d831e1 commit 8f921ba

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

nipype/interfaces/base/tests/test_core.py

+26
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,29 @@ class OOPBadShell(nib.CommandLine):
517517
ci = OOPBadShell(command=script_name)
518518
with pytest.raises(IOError):
519519
ci.run()
520+
521+
522+
def test_runtime_checks():
523+
class TestInterface(nib.BaseInterface):
524+
class input_spec(nib.TraitedSpec):
525+
a = nib.traits.Any()
526+
class output_spec(nib.TraitedSpec):
527+
b = nib.traits.Any()
528+
529+
def _run_interface(self, runtime):
530+
return runtime
531+
532+
class NoRuntime(TestInterface):
533+
def _run_interface(self, runtime):
534+
return None
535+
536+
class BrokenRuntime(TestInterface):
537+
def _run_interface(self, runtime):
538+
del runtime.__dict__['cwd']
539+
return runtime
540+
541+
with pytest.raises(RuntimeError):
542+
NoRuntime().run()
543+
544+
with pytest.raises(RuntimeError):
545+
BrokenRuntime().run()

0 commit comments

Comments
 (0)