depends_on#
- depends_on(*arg: str | dict[str, Any] | DependencySelector, when: str | dict[str, str] | None = None, **kwargs) None#
Require that test
argrun before this test.Usage#
.pyt:import canary canary.directives.depends_on(name, when=...) canary.directives.depends_on({"job": name, "when": ..., "expects": ...}, when=...) canary.directives.depends_on([{"job": name, "when": ..., "expects": ...}], when=...)
.vvt:#VVT: depends on (result=..., expect=..., options=..., platforms=..., testname=...) : argParameters#
arg: The test that should run before this test. Wildcards are allowed.when: Restrict processing of the directive to this condition
VVT Parameters#
result: Control whether or not this test runs based on the result of the dependent test. By default, a test will run if its dependencies pass or diff.expect: How many dependencies to expect.
The
whenexpression is limited to the following conditions:testname: Restrict processing of the directive to this test nameplatforms: Restrict processing of the directive to certain platform or platformsoptions: Restrict processing of the directive to command line-ooptionsparameters: Restrict processing of the directive to certain parameter names and values
Examples#
Run
spamifbazpasses or diffs..pyt:# spam.pyt import canary canary.directives.depends_on("baz") def test(): self = canary.testinstance baz = self.dependencies[0] print(f"baz's results can be found in {baz.working directory}")
.vvt:# spam.vvt # VVT: depends on: baz import vvtest_util as vvt def test(): working directory = vvt.DEPDIRS[0] print(f"baz's results can be found in {working directory}")
Run
spamregardless ofbaz’s result:.pyt:# spam.pyt import canary canary.directives.depends_on({"job": "baz", "when": "always"}) def test(): self = canary.testinstance baz = self.dependencies[0] print(f"baz's results can be found in {baz.working directory}")
.vvt:# spam.vvt # VVT: depends on (result=*) : baz import vvtest_util as vvt def test(): working directory = vvt.DEPDIRS[0] print(f"baz's results can be found in {working directory}")
spamdepends only on the serialbaztest:.pyt:# spam.pyt import canary canary.directives.depends_on("baz.cpus=1") def test(): self = canary.testinstance baz = self.dependencies[0] print(f"baz's results can be found in {baz.working directory}")
.vvt:# spam.vvt # VVT: depends on: baz.np=1 import vvtest_util as vvt def test(): working directory = vvt.DEPDIRS[0] print(f"baz's results can be found in {working directory}")