@@ -1212,8 +1212,56 @@ def test_shell_cmd_inputspec_9(tmpdir, plugin, results_function):
1212
1212
assert shelly .output_dir == res .output .file_copy .parent
1213
1213
1214
1214
1215
- @pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1215
+ @pytest .mark .parametrize ("results_function" , [result_no_submitter ])
1216
1216
def test_shell_cmd_inputspec_9a (tmpdir , plugin , results_function ):
1217
+ """
1218
+ providing output name using input_spec (output_file_template in metadata),
1219
+ the template has a suffix, the extension of the file will be moved to the end
1220
+ the change: input file has directory with a dot
1221
+ """
1222
+ cmd = "cp"
1223
+ file = tmpdir .mkdir ("data.inp" ).join ("file.txt" )
1224
+ file .write ("content" )
1225
+
1226
+ my_input_spec = SpecInfo (
1227
+ name = "Input" ,
1228
+ fields = [
1229
+ (
1230
+ "file_orig" ,
1231
+ attr .ib (
1232
+ type = File ,
1233
+ metadata = {"position" : 2 , "help_string" : "new file" , "argstr" : "" },
1234
+ ),
1235
+ ),
1236
+ (
1237
+ "file_copy" ,
1238
+ attr .ib (
1239
+ type = str ,
1240
+ metadata = {
1241
+ "output_file_template" : "{file_orig}_copy" ,
1242
+ "help_string" : "output file" ,
1243
+ "argstr" : "" ,
1244
+ },
1245
+ ),
1246
+ ),
1247
+ ],
1248
+ bases = (ShellSpec ,),
1249
+ )
1250
+
1251
+ shelly = ShellCommandTask (
1252
+ name = "shelly" , executable = cmd , input_spec = my_input_spec , file_orig = file
1253
+ )
1254
+
1255
+ res = results_function (shelly , plugin )
1256
+ assert res .output .stdout == ""
1257
+ assert res .output .file_copy .exists ()
1258
+ assert res .output .file_copy .name == "file_copy.txt"
1259
+ # checking if it's created in a good place
1260
+ assert shelly .output_dir == res .output .file_copy .parent
1261
+
1262
+
1263
+ @pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1264
+ def test_shell_cmd_inputspec_9b (tmpdir , plugin , results_function ):
1217
1265
"""
1218
1266
providing output name using input_spec (output_file_template in metadata)
1219
1267
and the keep_extension is set to False, so the extension is removed completely.
@@ -1263,7 +1311,7 @@ def test_shell_cmd_inputspec_9a(tmpdir, plugin, results_function):
1263
1311
1264
1312
1265
1313
@pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1266
- def test_shell_cmd_inputspec_9b (tmpdir , plugin , results_function ):
1314
+ def test_shell_cmd_inputspec_9c (tmpdir , plugin , results_function ):
1267
1315
"""
1268
1316
providing output name using input_spec (output_file_template in metadata)
1269
1317
and the keep_extension is set to False, so the extension is removed completely,
0 commit comments