artifact#

artifact(file: str, *, when: str | dict[str, str] | None = None, upon: str = 'always') None#

Save file as an artifact. This directive is not used by the test directly. Reporters can save a test’s artifacts at their destination. For instance, the artifacts may submitted to CDash as part of the test submission.

Usage#

.pyt:

import canary
canary.directives.artifact(file, *, when=..., upon=...)

.vvt: NA

Parameters#

  • when: Restrict processing of the directive to this condition

  • upon: Define when to save the artifact, based on the status of the job. * success: Save artifacts only when the job succeeds. * failure: Save artifacts only when the job fails or diffs. * always: Always save artifacts (except when jobs time out).

The when expression is limited to the following conditions:

  • testname: Restrict processing of the directive to this test name

  • platforms: Restrict processing of the directive to certain platform or platforms

  • options: Restrict processing of the directive to command line -o options

  • parameters: Restrict processing of the directive to certain parameter names and values

Examples#

import canary
canary.directives.artifacts("file.txt", when="platforms='not darwin'", upon="success")