Skip to content

Commit f6be432

Browse files
committed
test: Add CommandLine test to explicitly test quoting
1 parent 4d59218 commit f6be432

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nipype/interfaces/base/tests/test_core.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,3 +608,19 @@ def _run_interface(self, runtime):
608608

609609
with pytest.raises(RuntimeError):
610610
BrokenRuntime().run()
611+
612+
613+
def test_CommandLine_escape(tmp_path):
614+
test_file = tmp_path / "test file.txt"
615+
test_file.write_text("content")
616+
617+
class InputSpec(nib.TraitedSpec):
618+
in_file = nib.File(desc="a file", exists=True, argstr="%s")
619+
620+
class CatCommand(nib.CommandLine):
621+
input_spec = InputSpec
622+
_cmd = "cat"
623+
624+
command = CatCommand(in_file=str(test_file))
625+
result = command.run()
626+
assert result.runtime.stdout == "content"

0 commit comments

Comments
 (0)