enable#
- enable(*args: bool, when: str | dict[str, str] | None = None) None#
Explicitly mark a test to be enabled (or not)
Usage#
.pyt:import canary canary.directives.enable(arg, when=...)
.vvt:#VVT: enable (options=..., platforms=..., testname=...) : argParameters#
arg: Optional (default:True). IfTrue, enable the test. IfFalse, disable the testwhen: Restrict processing of the directive to this condition
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#
Explicitly disable a test
import canary canary.directives.enable(False)
#VVT: enable : false
Enable the test if the platform name is not “ATS”
import canary canary.directives.enable(True, when="platforms='not ATS'")
#VVT: enable (platform="not ATS") : true
More examples:
import canary canary.directives.enable(True, when="testname=foo platform='Darwin or Linux'") canary.directives.enable(True, when="platform='not Windows' options='not debug'") canary.directives.enable(False, when="testname=foo")
The above examples are equivalent to:
import canary canary.directives.enable(True, when={"testname": "foo", "platform": "Darwin or Linux"}) canary.directives.enable(True, when={"platform": "not Windows", "options": "not debug"}) canary.directives.enable(False, when={"testname": "foo"})
The
vvtequivalent are#VVT: enable (testname=foo, platform="Darwin or Linux") : true #VVT: enable (platform="not Windows", options="not debug") : true #VVT: enable (testname=foo) : false