|
8 | 8 | assert_true, assert_false, with_setup, package_check,
|
9 | 9 | skipif)
|
10 | 10 | import nipype.interfaces.base as nib
|
| 11 | +from nipype.utils.filemanip import split_filename |
11 | 12 | from nipype.interfaces.base import Undefined, config
|
12 | 13 | from traits.testing.nose_tools import skip
|
13 | 14 |
|
@@ -171,6 +172,26 @@ class DeprecationSpec3(nib.TraitedSpec):
|
171 | 172 | yield assert_equal, spec_instance.foo, Undefined
|
172 | 173 | yield assert_equal, spec_instance.bar, 1
|
173 | 174 |
|
| 175 | +def test_namesource(): |
| 176 | + tmp_infile = setup_file() |
| 177 | + tmpd, nme, ext = split_filename(tmp_infile) |
| 178 | + pwd = os.getcwd() |
| 179 | + os.chdir(tmpd) |
| 180 | + class spec2(nib.CommandLineInputSpec): |
| 181 | + moo = nib.File(name_source=['doo'], hash_files=False, argstr="%s", |
| 182 | + position=2) |
| 183 | + doo = nib.File(exists=True, argstr="%s", position=1) |
| 184 | + class TestName(nib.CommandLine): |
| 185 | + _cmd = "mycommand" |
| 186 | + input_spec = spec2 |
| 187 | + testobj = TestName() |
| 188 | + testobj.inputs.doo = tmp_infile |
| 189 | + yield assert_true, '%s_generated' % nme in testobj.cmdline |
| 190 | + testobj.inputs.moo = "my_%s_template" |
| 191 | + yield assert_true, 'my_%s_template' % nme in testobj.cmdline |
| 192 | + os.chdir(pwd) |
| 193 | + teardown_file(tmpd) |
| 194 | + |
174 | 195 | def checknose():
|
175 | 196 | """check version of nose for known incompatability"""
|
176 | 197 | mod = __import__('nose')
|
|
0 commit comments