@@ -1162,8 +1162,56 @@ def test_shell_cmd_inputspec_9(tmpdir, plugin, results_function):
1162
1162
assert shelly .output_dir == res .output .file_copy .parent
1163
1163
1164
1164
1165
- @pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1165
+ @pytest .mark .parametrize ("results_function" , [result_no_submitter ])
1166
1166
def test_shell_cmd_inputspec_9a (tmpdir , plugin , results_function ):
1167
+ """
1168
+ providing output name using input_spec (output_file_template in metadata),
1169
+ the template has a suffix, the extension of the file will be moved to the end
1170
+ the change: input file has directory with a dot
1171
+ """
1172
+ cmd = "cp"
1173
+ file = tmpdir .mkdir ("data.inp" ).join ("file.txt" )
1174
+ file .write ("content" )
1175
+
1176
+ my_input_spec = SpecInfo (
1177
+ name = "Input" ,
1178
+ fields = [
1179
+ (
1180
+ "file_orig" ,
1181
+ attr .ib (
1182
+ type = File ,
1183
+ metadata = {"position" : 2 , "help_string" : "new file" , "argstr" : "" },
1184
+ ),
1185
+ ),
1186
+ (
1187
+ "file_copy" ,
1188
+ attr .ib (
1189
+ type = str ,
1190
+ metadata = {
1191
+ "output_file_template" : "{file_orig}_copy" ,
1192
+ "help_string" : "output file" ,
1193
+ "argstr" : "" ,
1194
+ },
1195
+ ),
1196
+ ),
1197
+ ],
1198
+ bases = (ShellSpec ,),
1199
+ )
1200
+
1201
+ shelly = ShellCommandTask (
1202
+ name = "shelly" , executable = cmd , input_spec = my_input_spec , file_orig = file
1203
+ )
1204
+
1205
+ res = results_function (shelly , plugin )
1206
+ assert res .output .stdout == ""
1207
+ assert res .output .file_copy .exists ()
1208
+ assert res .output .file_copy .name == "file_copy.txt"
1209
+ # checking if it's created in a good place
1210
+ assert shelly .output_dir == res .output .file_copy .parent
1211
+
1212
+
1213
+ @pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1214
+ def test_shell_cmd_inputspec_9b (tmpdir , plugin , results_function ):
1167
1215
"""
1168
1216
providing output name using input_spec (output_file_template in metadata)
1169
1217
and the keep_extension is set to False, so the extension is removed completely.
@@ -1209,7 +1257,7 @@ def test_shell_cmd_inputspec_9a(tmpdir, plugin, results_function):
1209
1257
1210
1258
1211
1259
@pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1212
- def test_shell_cmd_inputspec_9b (tmpdir , plugin , results_function ):
1260
+ def test_shell_cmd_inputspec_9c (tmpdir , plugin , results_function ):
1213
1261
"""
1214
1262
providing output name using input_spec (output_file_template in metadata)
1215
1263
and the keep_extension is set to False, so the extension is removed completely,
0 commit comments