File tree Expand file tree Collapse file tree 1 file changed +46
-1
lines changed Expand file tree Collapse file tree 1 file changed +46
-1
lines changed Original file line number Diff line number Diff line change 14
14
DockerSpec ,
15
15
SingularitySpec ,
16
16
LazyField ,
17
+ ShellOutSpec ,
18
+ )
19
+ from ..task import (
20
+ TaskBase ,
21
+ ShellCommandTask
17
22
)
18
23
from ..helpers import make_klass
19
24
import pytest
20
-
25
+ import attr
21
26
22
27
def test_basespec ():
23
28
spec = BaseSpec ()
@@ -366,3 +371,43 @@ def test_input_file_hash_5(tmpdir):
366
371
f .write ("hi" )
367
372
hash3 = inputs (in_file = [{"file" : file_diffcontent , "int" : 3 }]).hash
368
373
assert hash1 != hash3
374
+
375
+
376
+
377
+ def test_task_inputs_mandatory_with_xOR ():
378
+ """input spec with mandatory inputs"""
379
+ input_fields = [
380
+ (
381
+ "input_1" ,
382
+ bool ,
383
+ {
384
+ "help_string" : "help" ,
385
+ "argstr" : "--i1" ,
386
+ "xor" : ("input_1" , "input_2" ),
387
+ }
388
+ ),
389
+ (
390
+ "input_2" ,
391
+ bool ,
392
+ {
393
+ "help_string" : "help" ,
394
+ "mandatory" : True ,
395
+ "argstr" : "--i2" ,
396
+ "xor" : ("input_1" , "input_2" ),
397
+ }
398
+ )
399
+ ]
400
+ task_input_spec = SpecInfo (name = "Input" , fields = input_fields , bases = (ShellSpec ,))
401
+ task_output_fields = []
402
+ task_output_spec = SpecInfo (name = "Output" , fields = task_output_fields , bases = (ShellOutSpec ,))
403
+
404
+ class MyTask (ShellCommandTask ):
405
+ input_spec = task_input_spec
406
+ output_spec = task_output_spec
407
+ executable = "task"
408
+
409
+ task = MyTask ()
410
+ task .inputs .input_1 = True
411
+ task .inputs .input_2 = True
412
+ task .inputs .check_fields_input_spec ()
413
+ #task.cmdline
You can’t perform that action at this time.
0 commit comments