testspec#

class Artifact(pattern: str, when: Literal['always', 'never', 'on_failure', 'on_success'] = 'always')#

Bases: object

pattern: str#
when: Literal['always', 'never', 'on_failure', 'on_success'] = 'always'#
active(status: Status) bool#
class Mask(value: bool, reason: str | None = None)#

Bases: object

value: bool#
reason: str | None = None#
classmethod masked(reason: str) Mask#
classmethod unmasked() Mask#
class BaseSpec(file_root: pathlib.Path, file_path: pathlib.Path, family: str = '', stdout: str = 'canary-out.txt', stderr: str | None = None, dependencies: MutableSequence[Any] = <factory>, dep_done_criteria: list[str] = <factory>, parameters: dict[str, typing.Any]=<factory>, attributes: dict[str, typing.Any]=<factory>, keywords: list[str] = <factory>, assets: list['Asset'] = <factory>, baseline: list[Any] = <factory>, artifacts: list[_canary.testspec.Artifact] = <factory>, exclusive: bool = False, timeout: float = -1.0, xstatus: int = 0, preload: str | None = None, modules: list[str] | None = None, rcfiles: list[str] | None = None, owners: list[str] | None = None, environment: dict[str, str]=<factory>, environment_modifications: list[dict[str, str]]=<factory>, meta_parameters: dict[str, typing.Any]=<factory>, command: list[str] = <factory>, id: str = '')#

Bases: Generic[T]

file_root: Path#
file_path: Path#
family: str = ''#
stdout: str = 'canary-out.txt'#
stderr: str | None = None#
dependencies: MutableSequence[Any]#
dep_done_criteria: list[str]#
parameters: dict[str, Any]#
attributes: dict[str, Any]#
keywords: list[str]#
assets: list[Asset]#
baseline: list[Any]#
artifacts: list[Artifact]#
exclusive: bool = False#
timeout: float = -1.0#
xstatus: int = 0#
preload: str | None = None#
modules: list[str] | None = None#
rcfiles: list[str] | None = None#
owners: list[str] | None = None#
environment: dict[str, str]#
environment_modifications: list[dict[str, str]]#
meta_parameters: dict[str, Any]#
command: list[str]#
id: str = ''#
asdict() dict[str, Any]#
dump(file: IO[Any], **kwargs: Any) None#
dumps(**kwargs: Any) Any#
add_artifact(pattern: str, when: Literal['always', 'never', 'on_failure', 'on_success'] = 'always') None#
classmethod from_dict(d: dict, lookup: dict[str, T]) T#
property file: Path#

Path to the test specification file

property mtime: float#
property name: str#
property fullname: str#
property viewpath: str#
property execpath: str#
display_name(style: Literal['none', 'rich', 'legacy-color'] = 'none', resolve: bool = False) str#
s_params(sep: str = ',') str | None#
property implicit_keywords: set[str]#

Implicit keywords, used for some filtering operations

property match_names: tuple[str, ...]#
matches(arg: str) bool#
set_attribute(name: str, value: Any) None#
set_attributes(**kwds: Any) None#
class ResolvedSpec(file_root: pathlib.Path, file_path: pathlib.Path, family: str = '', stdout: str = 'canary-out.txt', stderr: str | None = None, dependencies: MutableSequence[ForwardRef('ResolvedSpec')] = <factory>, dep_done_criteria: list[str] = <factory>, parameters: dict[str, typing.Any]=<factory>, attributes: dict[str, typing.Any]=<factory>, keywords: list[str] = <factory>, assets: list['Asset'] = <factory>, baseline: list[dict] = <factory>, artifacts: list[_canary.testspec.Artifact] = <factory>, exclusive: bool = False, timeout: float = -1.0, xstatus: int = 0, preload: str | None = None, modules: list[str] | None = None, rcfiles: list[str] | None = None, owners: list[str] | None = None, environment: dict[str, str]=<factory>, environment_modifications: list[dict[str, str]]=<factory>, meta_parameters: dict[str, typing.Any]=<factory>, command: list[str] = <factory>, id: str = '', mask: _canary.testspec.Mask = <factory>)#

Bases: BaseSpec[ResolvedSpec]

baseline: list[dict]#
dependencies: MutableSequence[ResolvedSpec]#
mask: Mask#
classmethod from_dict(d: dict, lookup: dict[str, ResolvedSpec]) ResolvedSpec#
class Asset(src: pathlib.Path, dst: str, action: Literal['copy', 'link', 'none'])#

Bases: object

src: Path#
dst: str#
action: Literal['copy', 'link', 'none']#
class DependencyPatterns(pattern: str, expects: str | int = '+', result_match: str = 'success')#

Bases: object

String representation of test dependencies

Dependency resolution is performed after test case discovery. The DependencyPatterns object holds information needed to perform the resolution.

Parameters:
  • value – The dependency name or glob pattern.

  • expect – For glob patterns, how many dependencies are expected to be found

  • result – The test case will run if the dependency exits with this status. Usually success

pattern: str#
expects: str | int = '+'#
result_match: str = 'success'#
patterns: list[str]#
resolves_to: list[str]#
matches(spec: UnresolvedSpec) bool#
update(*ids: str) None#
verify() list[str]#
class UnresolvedSpec(file_root: ~pathlib.Path, file_path: ~pathlib.Path, family: str = '', stdout: str = 'canary-out.txt', stderr: str | None = None, dependencies: ~typing.MutableSequence[str | ~_canary.testspec.DependencyPatterns] = <factory>, dep_done_criteria: list[str] = <factory>, parameters: dict[str, ~typing.Any] = <factory>, attributes: dict[str, ~typing.Any] = <factory>, keywords: list[str] = <factory>, assets: list[~_canary.testspec.Asset] = <factory>, baseline: list[str | tuple[str, str]] = <factory>, artifacts: list[~_canary.testspec.Artifact] = <factory>, exclusive: bool = False, timeout: float = -1.0, xstatus: int = 0, preload: str | None = None, modules: list[str] | None = None, rcfiles: list[str] | None = None, owners: list[str] | None = None, environment: dict[str, str] = <factory>, environment_modifications: list[dict[str, str]] = <factory>, meta_parameters: dict[str, ~typing.Any] = <factory>, command: list[str] = <factory>, id: str = '', file_resources: dict[~typing.Literal['copy', 'link', 'none'], list[tuple[str, str | None]]] = <factory>, mask: ~_canary.testspec.Mask = <factory>)#

Bases: BaseSpec[UnresolvedSpec]

Temporary object used to hold test spec properties until a concrete spec can be created after dependency resolution

dependencies: MutableSequence[str | DependencyPatterns]#
file_resources: dict[Literal['copy', 'link', 'none'], list[tuple[str, str | None]]]#
baseline: list[str | tuple[str, str]]#
mask: Mask#
baseline_actions: list[dict]#
dep_patterns: list[DependencyPatterns]#
resolved_dependencies: list[UnresolvedSpec]#
resolved: bool = False#
resolve(dependencies: list[ResolvedSpec], dep_done_criteria: list[str] | None = None) ResolvedSpec#
is_resolved() bool#
build_spec_id(spec: BaseSpec) str#
exception MutuallyExclusiveParametersError(name1, name2)#

Bases: Exception

exception UnresolvedDependenciesErrors(errors: list[str])#

Bases: Exception