@@ -1414,6 +1414,58 @@ def test_shell_cmd_inputspec_9c(tmpdir, plugin, results_function):
1414
1414
assert res .output .file_copy .parent == shelly .output_dir
1415
1415
1416
1416
1417
+ @pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1418
+ def test_shell_cmd_inputspec_9d (tmpdir , plugin , results_function ):
1419
+ """
1420
+ providing output name explicitly by manually setting value in input_spec
1421
+ (instead of using default provided byoutput_file_template in metadata)
1422
+ """
1423
+ cmd = "cp"
1424
+ file = tmpdir .mkdir ("data_inp" ).join ("file.txt" )
1425
+ file .write ("content\n " )
1426
+
1427
+ my_input_spec = SpecInfo (
1428
+ name = "Input" ,
1429
+ fields = [
1430
+ (
1431
+ "file_orig" ,
1432
+ attr .ib (
1433
+ type = File ,
1434
+ metadata = {"position" : 2 , "help_string" : "new file" , "argstr" : "" },
1435
+ ),
1436
+ ),
1437
+ (
1438
+ "file_copy" ,
1439
+ attr .ib (
1440
+ type = str ,
1441
+ metadata = {
1442
+ "output_file_template" : "{file_orig}_copy" ,
1443
+ "help_string" : "output file" ,
1444
+ "argstr" : "" ,
1445
+ },
1446
+ ),
1447
+ ),
1448
+ ],
1449
+ bases = (ShellSpec ,),
1450
+ )
1451
+
1452
+ shelly = ShellCommandTask (
1453
+ name = "shelly" ,
1454
+ executable = cmd ,
1455
+ input_spec = my_input_spec ,
1456
+ file_orig = file ,
1457
+ file_copy = "my_file_copy.txt" ,
1458
+ cache_dir = tmpdir ,
1459
+ )
1460
+
1461
+ res = results_function (shelly , plugin )
1462
+ assert res .output .stdout == ""
1463
+ assert res .output .file_copy .exists ()
1464
+ assert res .output .file_copy .name == "my_file_copy.txt"
1465
+ # checking if it's created in a good place
1466
+ assert shelly .output_dir == res .output .file_copy .parent
1467
+
1468
+
1417
1469
@pytest .mark .parametrize ("results_function" , [result_no_submitter , result_submitter ])
1418
1470
def test_shell_cmd_inputspec_10 (plugin , results_function , tmpdir ):
1419
1471
"""using input_spec, providing list of files as an input"""
0 commit comments