...
Code Block |
---|
| defs = Defs().add(
Suite("s1").add(
Task("t1"),
Task("t2").add(
Trigger("t1 == active and t3 == aborted"),
Complete("t3 == complete")),
Task("t3"))) |
|
Code Block |
---|
| defs = Defs().add(Suite("s1"))
defs.s1 += [ Task("t{}".format(i)) for i in range(1,4) ]
defs.s1.t2 += [ Trigger("t1 == active and t3 == aborted"),
Complete("t3 == complete") ] |
|
Adding triggers like '<nodepath> == complete' is extremely common. Hence there are a few short cuts;
Code Block |
---|
language | py |
---|
title | Shortcut for <nod> == complete |
---|
|
task = Task("t")
t = Trigger(["a","b",task]) # because Task("f") does have a parent, we will use the name
assert str(t) == "a == complete AND b == complete AND t == complete","Trigger not as expected: " + str(t))
defs = Defs()
task = defs.add_suite("s").add_family("f").add_task("t")
t = Trigger(["a","b",task]) # Task(t) has a parent hierarchy, hence we use full path in trigger expression
assert str(t) == "a == complete AND b == complete AND /s/f/t == complete","Trigger not as expected: " + str(t)) |